Documentation ¶
Overview ¶
Package gosockjs is an implementation of a SockJS server.
See https://github.com/sockjs .
SockJS is intended to be used much like websockets, and gosockjs attempts to mirror the websocket interface, with the complication that the infrastructure needs to know the base url in order to set up all the routing. A simple gosockjs server looks like
func echo(c *gosockjs.Conn) { io.Copy(c, c) } func main() { gosockjs.Install("/echo", echo) http.ListenAndServe(":8081", nil) }
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var EmptyPayload error = errors.New("Payload expected.")
View Source
var JSONError error = errors.New("Broken JSON encoding.")
Functions ¶
This section is empty.
Types ¶
type Conn ¶
type Conn struct {
// contains filtered or unexported fields
}
Conn is a SockJS connection. It is a ReadWriteCloser
type Router ¶
type Router struct { WebsocketEnabled bool CookieNeeded bool DisconnectDelay time.Duration HeartbeatDelay time.Duration // contains filtered or unexported fields }
Router handles all the SockJS requests.
func Install ¶
Install creates and installs a Router into the default http ServeMux. baseUrl should be an absolute path.
Notes ¶
Bugs ¶
xhr connections cannot be reused.
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
A very simple client for testing gosockjs.
|
A very simple client for testing gosockjs. |
Click to show internal directories.
Click to hide internal directories.