Thanks to visit codestin.com
Credit goes to github.com

Skip to content
This repository was archived by the owner on Oct 26, 2019. It is now read-only.

Separate socket server from the HTTP API. #241

Merged
merged 3 commits into from
Jul 15, 2018

Conversation

goto-bus-stop
Copy link
Member

@goto-bus-stop goto-bus-stop commented Jul 3, 2018

With this patch the HttpApi class no longer handles the socket server. Instead users have to instantiate it manually. This actually makes the API less weird; previously you had to pass a Node core HTTP server instance to the middleware creation function, essentially a circular dependency. Now you can add the middleware to the express server, then get the HTTP server instance from the express server and pass it to the socket server function.

All communication between the HTTP API and the socket server goes through Redis messages now. The only remaining thing to migrate was the temporary auth tokens the socket server uses; they were already stored in Redis but the authentication routes used API methods from the socket server object. Now the routes don't need access to the socket server object anymore.

It needs more work on the u-wave-core side, but this is one step to allowing the socket server to run in its own process. That would be real neat because we could do server updates (if the socket server was not changed, which is true a good chunk of the time) without everyone's chat connections dying :)

This changes the API so users have to set up both the HTTP API and the
socket server.
@goto-bus-stop goto-bus-stop force-pushed the feature/separate-socket-server branch from 3db6bb4 to 879ea84 Compare July 10, 2018 12:27
@goto-bus-stop goto-bus-stop merged commit f123c41 into master Jul 15, 2018
@goto-bus-stop goto-bus-stop deleted the feature/separate-socket-server branch July 21, 2018 14:21
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant