Open
Description
- Package Name: @azure/web-pubsub-client
- Package Version:
^1.0.0-beta.3
- Operating system: Windows
- nodejs
- version: v21.1.0
- browser
- name/version: Google Chrome/119.0.6045.200
- typescript
- version:
^5.0.0
- version:
Describe the bug
Can't initialise a new WebPubSubClient
instance in my Sveltekit project. I'm getting the error TypeError: import_events.default is not a constructor
(see screenshot to show where)
To Reproduce
Steps to reproduce the behavior:
- Create a new skeleton Sveltekit project with Typescript:
npm create svelte@latest bug-test
- Add the following code to the
+page.svelte
file<script lang="ts"> import { WebPubSubClient } from '@azure/web-pubsub-client'; let tokenUrl = "<add token url>"; let client: WebPubSubClient; async function connect() { client = new WebPubSubClient(tokenUrl); await client.start(); client.on('connected', () => console.log('Web PubSub Connected')); client.on('group-message', m => console.log('Message received: %s', JSON.stringify(m))); } </script> <button on:click={connect}>Connect</button>
- Run the server and click the button
Expected behavior
The client should be initialised so I can connect to the Web PubSub
Additional context
I'm not a frontend developer in any way, but I'll try my best to give as much info as possible.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment