There are a couple of modules using websockets in the appstore like websockets push, ez websockets and websocket module which you can directly use or inspect the javascript code in the widget or nanoflows.
Also code to create typescript in a nanoflow can be googled like Working with Websockets
Websockets using JavaScript work in the client, so are running in the browser. We can use Nanoflows to interact with JavaScript using JavaScript Actions.
Microflows run on the server and can't talk to JavaScript in the client directly.
However, you can use Nanoflows to talk to both Websockets and Microflows.
Good luck!