Server
Overview
Server registers WebSocket routes.
Part of the ws package — Node.js analog: ws.
Server is a type exported by gox. Methods on this type are documented separately.
Signature
go
type Server struct {
Upgrader Upgrader
}Compare: Node.js · Standard Go · gox
js
// Typical ws pattern in Node.jsgo
// gorilla/websocket Upgrader or Dialergo
import "github.com/sahilkhaire/gox/ws"
srv := ws.NewServer()
srv.Handle("/ws", handler)Example
go
import "github.com/sahilkhaire/gox/ws"
srv := ws.NewServer()
srv.Handle("/ws", handler)Tips
Browse methods on this type in the sidebar for handler-style APIs and options structs.
Standard library alternative
gox wraps the Go standard library or a trusted dependency with Node-familiar naming. You can use the underlying library directly — see the package overview for escape hatches.