Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Workshopper for web-sockets (with socket.io?) #28

Open
martinheidegger opened this issue Dec 4, 2014 · 3 comments
Open

Workshopper for web-sockets (with socket.io?) #28

martinheidegger opened this issue Dec 4, 2014 · 3 comments

Comments

@martinheidegger
Copy link
Contributor

I have been asked at the NodeSchool Osaka tonight about a workshop specifically for socket.io. I was shocked to find that it doesn't exist. Probably there should be one at least on that topic. Isn't this one of the most-common uses of Node.JS?

@afronski
Copy link

@martinheidegger We were shocked as well, the same question appeared at NodeSchool Silesia meeting. We're trying to develop something here: https://github.com/rspective/websockito (we've used recently released how-to-npm as a starting point).

At the beginning we would like to focus on two modules - ws and socket.io used only on the server side, at least for now. Feedback and help is welcome!

Do you have any idea (or even better - feedback from community) what topic should be covered in such workshop?

@martinheidegger
Copy link
Contributor Author

@timoxley and me just talked on gitter about a content for a socket.io workshopper and we came up with two different approaches to it that could build on each other.

Approach 1: Form -> Socket

A form submission workshop that incrementally works up to websockets:

  1. Submit with HTTP Post. Reload data as natural page refresh on POST.
  2. HTTP Post over XHR. Reload data by auto refreshing page.
  3. Manually update results with HTTP GET with XHR.
  4. Switch from manual update to polling.
  5. Switch from polling to long-polling.
  6. Switch from long-polling to raw SSE
  7. Switch from raw SSE to raw WebSockets
  8. Switch from raw WebSockets to socket.io

Approach 2: (Integrated) Socket -> Hardcore Socket

Build against a decentralised (optionally online) Server system that starts with the basics of sockets but soon becomes a lot more complex.

  1. Use sockets to send a message to a central server. (hosted on heroku/modulus/gcp/aws/.. <- sponsor?)
  2. Receive a message from the server
  3. Automatically try to reconnect to the server
  4. Change the socket system to use an automated endpoint lookup (keyword: bittorrent)
  5. Create a socket server and relay a message from a (given) client to the central server.
  6. Use data from the central server to store a shared state.
  7. Connect an express/hapi/koa session to a socket.io session and send it to the central server.
  8. Deny access to a certain client based on session and write log to central server.
  9. Cleanly shutdown the server with a notification towards the central server and clients.
  10. Send A/V content over socket
  11. Secure the socket connection

@timoxley
Copy link

The flow I described is designed to ensure people understand the lesser-known alternatives like long-polling and SSE as well as giving people a taste of how to use websockets.

Underlying motivation is to curb the "websockets for everything" trend that's been going on for a few years now while alternatives are more widely supported, accessible and often more suited to the task at hand. Particularly, I'd like to raise awareness of SSE, which can replace a large number of places where websockets are currently used, without the proxying/intermediaries hassles of websockets (though this is getting better).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants