Skellington-Closet / slack-mock

A Slack API mocker for Slack bot integration tests.
MIT License
64 stars 15 forks source link

refactor RTM server #15

Closed colestrode closed 7 years ago

colestrode commented 7 years ago

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.

Add token to the RTM call object.