Create a single express server on the passed port. Create a new WSS server for each token that is passed using the path and the server options. This makes creating a WSS server synchronous.
Keep a map of token to server. Use this for send so that send no longer needs to accept a client. This eliminates the need for broadcast, which was just way to provide an interface for sending without needing a client.
This will require that token must be passed with each request. That should be fine, since bots should be doing that anyway. We'll need to add that to the docs.
How will this affect the stopServer, startServer flow? Those should take a token as well.
Is there any reason to expose the clients? Maybe... but add a _token property to it. Replace clients array with a getClient method that takes a token and returns a client from the WSS server. Need to set trackClients true.
Create a single express server on the passed port. Create a new WSS server for each token that is passed using the
path
and theserver
options. This makes creating a WSS server synchronous.Keep a map of token to server. Use this for
send
so that send no longer needs to accept a client. This eliminates the need forbroadcast
, which was just way to provide an interface for sending without needing a client.This will require that token must be passed with each request. That should be fine, since bots should be doing that anyway. We'll need to add that to the docs.
How will this affect the stopServer, startServer flow? Those should take a token as well.
Is there any reason to expose the clients? Maybe... but add a
_token
property to it. Replace clients array with agetClient
method that takes a token and returns a client from the WSS server. Need to settrackClients
true.Add
token
to the RTMcall
object.