The documentation for Network.WebSockets.runServer says:
Note that this is merely provided for quick-and-dirty standalone applications, for real applications, you should use a real server.
Is this "real server" a reference to something that I'm supposed to know about (if I were more familiar with the Haskell ecosystem), or something that doesn't exist yet?
By definition websockets like normal sockets are client-server so yes, you need a server. However there is an alternative to waiting for Apache plugins. I am using a hosted server http://www.achex.ca. Its free and you have tutorials in javascript on how to use the server.
A WebSocket server is nothing more than an application listening on any port of a TCP server that follows a specific protocol. The task of creating a custom server tends to scare people; however, it can be straightforward to implement a simple WebSocket server on your platform of choice.
WebSockets are used for real-time communication between the browser and a server. These communications are bi-directional. Therefore it fits low latency applications such as chat, real-time multiplayer gaming, in-app notifications.
The actual server can be any TCP application. All you need is support of Berkeley socket from your programming language. This is a nice tutorial from Mozilla on how to write a websocket server.
The real production quality server in Haskell ecosystem is warp. You can use wai-websockets to target it to Warp. In fact wai-websockets
uses the package websockets
internally.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With