ws
Package ws provides WebSocket client and server helpers. Node equivalent: ws, lightweight socket.io patterns.
import "github.com/sahilkhaire/gox/ws"
Select a symbol below — each page explains what it does, shows Node.js vs Go comparisons, and includes a runnable example.
Types
| Symbol | Node.js | Kind | Summary |
|---|---|---|---|
| Conn | — | type | Conn wraps a gorilla WebSocket connection with JSON helpers. |
| Server | — | type | Server registers WebSocket routes. |
| Upgrader | — | type | Upgrader upgrades HTTP connections to WebSocket. |
| WSHandler | — | type | WSHandler is a WebSocket connection handler. |
Methods
| Symbol | Node.js | Kind | Summary |
|---|---|---|---|
| Conn.Dial | — | method | Dial connects to the WebSocket url. |
| Server.NewServer | — | method | NewServer creates a WebSocket server with the given upgrader (nil uses DefaultUpgrader). |
| Conn.Upgrade | — | method | Upgrade upgrades the HTTP request on w/r using up (nil uses DefaultUpgrader). |
Variables
| Symbol | Node.js | Kind | Summary |
|---|---|---|---|
| DefaultUpgrader | — | var | DefaultUpgrader allows all origins (suitable for tests; tighten in production). |