2020-08-26 13:27:00 -07:00
|
|
|
// Copyright 2015 Ola Holmström. All rights reserved.
|
|
|
|
// Use of this source code is governed by a BSD-style
|
|
|
|
// license that can be found in the LICENSE file.
|
|
|
|
|
|
|
|
// Package melody implements a framework for dealing with WebSockets.
|
|
|
|
//
|
|
|
|
// Example
|
|
|
|
//
|
|
|
|
// A broadcasting echo server:
|
|
|
|
//
|
|
|
|
// func main() {
|
|
|
|
// m := melody.New()
|
2023-03-11 09:14:49 -08:00
|
|
|
// http.HandleFunc("/ws", func(w http.ResponseWriter, r *http.Request) {
|
|
|
|
// m.HandleRequest(w, r)
|
2020-08-26 13:27:00 -07:00
|
|
|
// })
|
|
|
|
// m.HandleMessage(func(s *melody.Session, msg []byte) {
|
|
|
|
// m.Broadcast(msg)
|
|
|
|
// })
|
2023-03-11 09:14:49 -08:00
|
|
|
// http.ListenAndServe(":5000", nil)
|
2020-08-26 13:27:00 -07:00
|
|
|
// }
|
2023-03-11 09:14:49 -08:00
|
|
|
|
2020-08-26 13:27:00 -07:00
|
|
|
package melody
|