You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Because the go.net websocket implementation has a built-in JSON codec (which uses json.Marshal under the hood, of course). So that will make your code a bit more DRY.
Also you should check for errors:
iferr:=websocket.JSON.Send(wsc.socket, message); err!=nil {
log.Println("wsconnection: error, could not send json message, ", err)
// or do something else if you want...
}
The text was updated successfully, but these errors were encountered:
Well, you asked for it in your readme:
Could become:
Because the go.net websocket implementation has a built-in JSON codec (which uses
json.Marshal
under the hood, of course). So that will make your code a bit more DRY.Also you should check for errors:
The text was updated successfully, but these errors were encountered: