Coding With Fun
Home Docker Django Node.js Articles Python pip guide FAQ Policy

Revel Websockets


May 15, 2021 Revel



Revel provides Websockets support.

Working with a Websocket connection:

  1. Add a WS route.
  2. Add an acceptance *websocket.Conn of the Conn parameter.

Raise a chestnut and add a route to the routes file:

WS /app/feed Application.Feed

Add a controller method to accept the *websocket.Conn parameters:

import "code.google.com/p/go.net/websocket"

func (c App) Feed(user string, ws *websocket.Conn) revel.Result {
    ...
}