[x] Refactored the way we attach new handlers to HTTP server or create new servers. The server.ForPort(port) function is introduced which creates a new server for the specified port or returns the existing one (Host and SSL options are shared among all the servers created this way).
[x] Added some missing HTTP handlers tests.
[x] Refactored node mocks to make it easier to use them in other packages tests.
Is there anything you'd like reviewers to focus on?
A couple of things I'd be glad to get some feedback on:
server.allServers trick to re-use HTTP servers for different components
node.AppNode interface and its usages; it's a very basic implementation useful just for pub/sub components; I gave up on adding it everywhere—too much work; maybe, later.
What is the purpose of this pull request?
Add support for HTTP broadcasting (see https://github.com/anycable/anycable/pull/100).
What changes did you make? (overview)
server.ForPort(port)
function is introduced which creates a new server for the specified port or returns the existing one (Host and SSL options are shared among all the servers created this way).node
mocks to make it easier to use them in other packages tests.Is there anything you'd like reviewers to focus on?
A couple of things I'd be glad to get some feedback on:
server.allServers
trick to re-use HTTP servers for different componentsnode.AppNode
interface and its usages; it's a very basic implementation useful just for pub/sub components; I gave up on adding it everywhere—too much work; maybe, later.Checklist