Skip to content
Node: ws8 APIs

ws

Package ws provides WebSocket client and server helpers. Node equivalent: ws, lightweight socket.io patterns.

import "github.com/sahilkhaire/gox/ws"
## API reference

Select a symbol below — each page explains what it does, shows Node.js vs Go comparisons, and includes a runnable example.

Types ​

SymbolNode.jsKindSummary
Conn—typeConn wraps a gorilla WebSocket connection with JSON helpers.
Server—typeServer registers WebSocket routes.
Upgrader—typeUpgrader upgrades HTTP connections to WebSocket.
WSHandler—typeWSHandler is a WebSocket connection handler.

Methods ​

SymbolNode.jsKindSummary
Conn.Dial—methodDial connects to the WebSocket url.
Server.NewServer—methodNewServer creates a WebSocket server with the given upgrader (nil uses DefaultUpgrader).
Conn.Upgrade—methodUpgrade upgrades the HTTP request on w/r using up (nil uses DefaultUpgrader).

Variables ​

SymbolNode.jsKindSummary
DefaultUpgrader—varDefaultUpgrader allows all origins (suitable for tests; tighten in production).

MIT Licensed · Built for Node.js developers moving to Go