rest - Golang: Broadcast messages to websocket when a particular POST JSON is received -


i have app connected goserver using websocket . used code create websocket connection - https://github.com/gorilla/websocket/tree/master/examples/chat

http.handlefunc("/ws", func(w http.responsewriter, r *http.request) {         servews(hub, w, r)     }) 

when receive post call need broadcast message - "order received: " productnum devices. productnum received in post request.

http.handlefunc("/post",broadcastmessage()) 

i want know need write in broadcastmessage() this. please help.

in broadcastmessage, send []byte hub's broadcast channel:

 hub.broadcast <- message 

Comments

Popular posts from this blog

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -