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
Intel Patch For Outdated Microcode?
Intel engineer Dave Hansen has sparked a “Microcode Revision Discussion” regarding a proposed Linux patch on the kernel mailing list. This new feature would report outdated microcode through the existing sysfs vulnerabilities reporting system. Specif
Linux Format1 min read
Get More Pieces Of Pi
Les Pounder works with groups such as the Raspberry Pi Foundation to help boost people’s maker skills. My desk has seen a plethora of Raspberry Pi products these last two weeks, starting with the new Raspberry Pi-branded microSD cards and a rubber bu
Linux Format13 min read
Fyne Times Ahead
Developing software to run across Linux distros is bad enough, but Andrew Williams, CEO of Fyne Labs (https://fynelabs.com), is making software easier to run across operating systems, devices and the web. We sat down with him and chatted about Go, Ja

Related Books & Audiobooks

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy