alanshaw / it-ws

🕸 🔌 Simple async iterators for websocket client and server connections
Other
11 stars 11 forks source link

Export WebSocket #78

Closed paralin closed 10 months ago

paralin commented 1 year ago

import WebSocket from 'it-ws/dist/src/web-socket.js';

Would it be possible to add an export for import WebSocket from 'it-ws/websocket' ?

Thanks.

paralin commented 10 months ago

@achingbrain Hi - still need this, I've been using this hack:

import WebSocket from 'it-ws/dist/src/web-socket.js'

But that doesn't work anymore as it's not in exports.

I went ahead and sent a PR: #99

achingbrain commented 10 months ago

It’s worth noting that node 21 will have a websocket implementation so you should probably switch to that when it’s no longer behind a flag.

paralin commented 10 months ago

@achingbrain thanks. Does that also work in the web browser? I guess it would since the type is available in both places natively.

achingbrain commented 10 months ago

Yes, it’ll be global in both environments.