Get full bidirectional real-time communication for your application by implementing a WebSockets server with Deno.
WebSockets is a communications protocol that allows bidirectional, persistent communication as an alternative to HTTP. Suppose you wanted to get updates to some server state. With HTTP, you would need to poll frequently for the data.
But there are limitations to HTTP polling:
With WebSockets, clients don’t need to ask the server for new data, the web sockets server simply pushes the new data directly to the client.
WebSockets should be used when you need real-time functionality in your application — for example, a chat application or a bot that watches the stock market. WebSockets are best used in situations where you need to react quickly to frequently changing data. If the your application data doesn’t change often, it may be best to implement simple polling logic instead.
WebSockets use HTTP as the mechanism to initiate a connection to the server. This connection is then upgraded to a WebSocket connection.
Clients can only access WebSocket servers through a URI scheme of either ws://
or wss://
. To initiate a WebSockets connection, you must first implement a WebSocket client and have a supporting WebSockets server. That’s where Deno comes in.
Here’s what we’ll cover in this tutorial:
#websocket #deno