Revel provides support for Websockets.
To handle a Websocket connection:
- Add a route using the
WS
method. - Add an action that accepts a
revel.ServerWebSocket
parameter.
See the example chat application
Simple Websocket Example
Add this to the conf/routes
file:
WS /app/feed Application.Feed
Then write an action like this:
import "github.com/revel/revel"
func (c App) Feed(user string, ws revel.ServerWebSocket) revel.Result {
...
}