Ola Holmström 3f253801bf demo
2015-05-13 23:43:22 +02:00
2015-05-13 23:43:22 +02:00
2015-05-13 22:47:09 +02:00
2015-05-13 23:15:10 +02:00
2015-05-13 22:37:17 +02:00
2015-05-13 23:15:10 +02:00
2015-05-13 23:15:10 +02:00
2015-05-13 23:17:16 +02:00
2015-05-13 23:43:22 +02:00
2015-05-13 23:17:16 +02:00

melody

GoDoc Build Status

🎶 Simple websocket framework for Go

Install

go get github.com/olahol/melody

Example

Simple broadcasting chat server, error handling left as en exercise for the developer.

package main

import (
	"github.com/olahol/melody"
	"github.com/gin-gonic/gin"
	"net/http"
)

func main() {
	r := gin.Default()
	m := melody.New()

	r.GET("/", func(c *gin.Context) {
		http.ServeFile(c.Writer, c.Request, "index.html")
	})

	r.GET("/ws", func(c *gin.Context) {
		m.HandleRequest(c.Writer, c.Request)
	})

	m.HandleMessage(func(s *melody.Session, msg []byte) {
		m.Broadcast(msg)
	})

	r.Run(":5000")
}

Chat demo

S
Description
🎶 Minimalist websocket framework for Go
Readme 1.1 MiB
Languages
Go 100%