Enable and disable MockSocket at runtime
I would like to switch between a mocked socket and a real websocket during development in the frontend. For this reason I am looking for a way to switch the mock socket on and off at runtime.
Unfortunately, I did not find anything in the documentation on how to achieve this. Is it possible to achieve this with the Server.stop(...) method because internally this method takes something out of the networkBridge.removeServer(this.url)? Probably not because the global real websocket is overwritten by the mock. What is the right way here?
Thank you very much in advance.
I think I've found what I'm looking for, restoreWebsocket and mockWebsocket can turn on/off the mockSocketServer at runtime.
We should add this to the documentation (README.md). If that is ok, I would create a MR for this.
mockWebsocket (enable)
https://github.com/thoov/mock-socket/blob/54ba9ced41f424397552879d937da99aa56fface/src/server.js#L46-L51
restoreWebsocket (disable)
https://github.com/thoov/mock-socket/blob/54ba9ced41f424397552879d937da99aa56fface/src/server.js#L56-L63
@SerkanSipahi Yep, it is. Go on, you can create a pull request for this