Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
golang sample of json/rpc over websocket
package main
import (
type Args struct {
A int
B int
type Arith int
func (t *Arith) Multiply(args *Args, reply *int) error {
*reply = args.A * args.B
return nil
func main() {
http.Handle("/conn", websocket.Handler(serve))
http.ListenAndServe("localhost:7000", nil)
func serve(ws *websocket.Conn) {

This comment has been minimized.

Copy link

commented Nov 20, 2014

Does this close the connection once the RPC call is executed ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.