Essayer OR - Gratuit
Create your first WebSocket service
Linux Format
|April 2023
Mihalis Tsoukalos explains how to use the Go programming language to work with the WebSocket protocol.

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 here, or https://godoc.org/ nhooyr.io/websocket instead.
As
Cette histoire est tirée de l'édition April 2023 de Linux Format.
Abonnez-vous à Magzter GOLD pour accéder à des milliers d'histoires premium sélectionnées et à plus de 9 000 magazines et journaux.
Déjà abonné ? Se connecter
PLUS D'HISTOIRES DE Linux Format

Linux Format
Create your first WebSocket service
Mihalis Tsoukalos explains how to use the Go programming language to work with the WebSocket protocol.
9 mins
April 2023

Linux Format
Fantastic Mr Firefox
Nick Peers takes a trip down memory lane to reveal the story behind the rise - and slight fall - of Mozilla's popular web browser.
9 mins
April 2023

Linux Format
Set up your terminal and email like it's 1983
Jump in the hot terminal time machine with Mats Tage Axelsson who emails from the command line using the latest technology.
8 mins
April 2023

Linux Format
Universal layer text effects with GIMP
Posters use them, films and presentations are hard to imagine without them: text effects. Attract attention with Karsten Günther and GIMP.
8 mins
April 2023

Linux Format
Jump to a federated social network
Nick Peers reveals how you can get up and running with this free, decentralised and non-profit alternative to Twitter.
9 mins
April 2023

Linux Format
Free our SOFTWARE!
Taking anything for granted is dangerous, so Jonni Bidwell and Mike Saunders revisit how the free software movement got started to help free us from proprietary tyranny!
4 mins
April 2023

Linux Format
Master RPI.GPIO
Les Pounder goes back to the early days of the Raspberry Pi - and his career with this classic library! -
5 mins
April 2023

Linux Format
Waveshare Zero to Pi3
Transform your Pi Zero into a Pi 3, they promised Les Pounder, but it's more like adding on go-faster stripes.
2 mins
April 2023

Linux Format
The Best OPEN SOURCE Software Ever!
In an attempt to trigger controversy, Michael Reed and Neil Mohr unequivocally state these are the greatest free software apps ever. Probably. We’re just trying to be helpful.
19 mins
April 2023

Linux Format
Linux-Mandrake 7
Simplicity and a wide range of applications make this a great distribution for all Linux users.
2 mins
April 2023
Translate
Change font size