Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

UNLIMITED

Linux Format

WEBSOCKET

OUR EXPERT

Mihalis Tsoukalos is a systems engineer and a technical writer. He is the author of Go Systems Programming and Mastering Go. You can reach him at @mactsouk.

This tutorial covers the WebSocket protocol and how to work with it using the Go programming language. We’re going to develop a WebSocket client and a WebSocket server that can interact with each other. In the process, we are also going to learn the basics of Unix signal handling in Go and how to test a WebSocket server using the Websocat command line utility as well as JavaScript.

Go is an open source programming language and WebSocket is an open protocol. The same applies to HTML and JavaScript, as well as Linux. People make a living from open source projects, tools, technologies and ideas, so please recognise that and contribute in any way you can. Many thanks to all these people!

Gorilla sockets

To develop a small yet fully functional WebSocket server, we’re using the gorilla/websocket (https:// github.com/gorilla/websocket) module. The server implements the Echo service, which means that it automatically returns its input to the client. It also expects to get client input before sending data back.

Apart from gorilla/websocket, the golang.org/x/ net/websocket package offers another way of developing WebSocket clients and servers. However, according to its documentation, golang.org/x/net/websocket lacks some features and it is advised that you use https://godoc.org/github.com/gorilla/ websocket, the one used

You’re reading a preview, subscribe to read more.

More from Linux Format

Linux Format1 min read
Android Gets More Linux
According to recent Android Open Source Project commits, Google plans to include a native Terminal utility in Android 16. This will build on the Android Virtualization Framework, introduced in v13. The exact implementation isn’t clear but ferrochrome
Linux Format1 min read
Working Together
This year’s annual conference of the LibreOffice community was held in Luxembourg, with a different approach from previous years, involving more presentations on open source software. During the opening session, there were speeches by the minister fo
Linux Format2 min read
Recordbox
Version: 0.8.1 Web: https://codeberg.org/edestcroix/Recordbox Just as good music is a matter of taste, and one that’s quite subjective, music players are designed to cater to different needs as well. Unlike most other desktop music players, Recordbox

Related Books & Audiobooks