ryo-ma / deno-websocket

🦕 A simple WebSocket library like ws of node.js library for deno
https://deno.land/x/websocket
MIT License
152 stars 17 forks source link

Difference with std/ws and native WebSocket? #22

Closed fonsp closed 3 years ago

fonsp commented 3 years ago

Hey! I was looking for websocket capabilities in deno using google ("deno websocket"), and this was the first result. Later, I found that the native web API WebSocket is already supported in deno for ws clients, and there is a ws standard library for hosting a ws server.

Perhaps on the README you could clarify the relation between this package and those two alternatives? Which would you recommend for newcomers?

Thanks! -fons

ryo-ma commented 3 years ago

This package is wrapping the native web API Websocket Client and the ws standard library. You can execute the callback of WebSocket as an EventEmitter. Good Idea. I will write the description on the README.

fonsp commented 3 years ago

I see! So this package would be best for people coming from NodeJS, while people coming from browser JS should use the native WebSocket capabilities?

ryo-ma commented 3 years ago

No problem in choosing freely. I will respect the user's choices.