denoland / std

The Deno Standard Library
https://jsr.io/@std
MIT License
3.21k stars 621 forks source link

Web sockets. #29

Closed ry closed 5 years ago

keroxp commented 5 years ago

https://github.com/keroxp/deno-ws

Hi, I created an experimental websocket server with deno. I hope this is useful for you.

Thanks.

ry commented 5 years ago

@keroxp How well is it working? Can you give us a status update? What are the major missing features? Would you be open to including that in deno_std?

keroxp commented 5 years ago

@ry There are no major missing features from server-side point of view. WebSocket server based on RFC 6455 works fine.

However WebSocket client for deno runtime hasn't been implemented because there are no way(?) to open HTTP connection for upgrading to websocket, fetch() api doesn't suit this purpose.

Minor missing features are some websocket extension protocol handler (e.g. permessage deflate). But their implementation may be optional. WebSocket client that is written by Node.js (wscat, by ws)could connect to the server that running on deno.

Would you be open to including that in deno_std?

Yes! I hope that it will be merged into deno_std, if you plan to place WebSocket API on deno's standard library.

ry commented 5 years ago

However WebSocket client for deno runtime hasn't been implemented because there are no way(?) to open HTTP connection for upgrading to websocket, fetch() api doesn't suit this purpose.

You can use deno.dial() ... but it won't work over https. I've been considering to reimplement fetch using deno.dial() once we can support TLS.

Yes! I hope that it will be merged into deno_std, if you plan to place WebSocket API on deno's standard library.

Great! Can you prepare a PR?

keroxp commented 5 years ago

@ry I opened PR for websocket. Please review it!

keroxp commented 5 years ago

@ry Can be closed?

ry commented 5 years ago

yes thanks

https://github.com/denoland/deno_std/tree/57c9176b19bf4f4580466e088c249cbe9b145119/ws