websocket

command
v0.0.0-...-1361a3d Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 3, 2024 License: MIT Imports: 14 Imported by: 0

README

websocket

This directory contains an echo websocket server.

It authenticates with a token in header.

The example go code based on: https://github.com/nhooyr/websocket/tree/master/examples/echo

Run

./run.sh 
# ## wait for server to start
# listening on http://127.0.0.1:5000
# ## authenticated with a hardcoded token in header
# ## now you can type like echo command
# Connected (press CTRL+C to quit)
# > echo 
# < echo
# > test
# < test
# > kjlfads
# < kjlfads
# > failed to echo with 127.0.0.1:50214: failed to get reader: received close frame: status = StatusNoStatusRcvd and reason = ""
# Terminated

Reference

We use package https://pkg.go.dev/nhooyr.io/websocket

How to play with websocket

Use wscat to connect to a WebSocket API and send messages to it

Or use hashrocket/ws, but it doesn't support sub-protocol.

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL