olahol / melody

:notes: Minimalist websocket framework for Go
BSD 2-Clause "Simplified" License
3.75k stars 366 forks source link

Any chance for a client? #15

Closed macnibblet closed 2 years ago

macnibblet commented 8 years ago

Heya,

I have been looking for something that would provide a clean wrapper around the x/net/websocket or gorilla websocket, but I have not found any good solution yet.

Zamiell commented 7 years ago

Are you meaning a JavaScript WebSocket client? You could try this:

https://github.com/trevex/golem_client

It's fairly clean, at under 100 lines.

Zamiell commented 7 years ago

I'm using a modified version of the Golem client for my Melody project: https://github.com/Zamiell/isaac-racing-client/blob/master/src/js/lib/golem.js

And on the server side it looks like this: https://github.com/Zamiell/isaac-racing-server/blob/master/src/websocketHandleMessage.go#L38-L75

mjarkk commented 5 years ago

Lately i'm using the builtin client new WebSocket,
You can use it like this:

// change the ws:// to wss:// if your website runs over https
const ws = new WebSocket(`ws://${location.host}/your-websocket-route`)
ws.onmessage = msg => {
  console.log(msg)
}
kaiaverkvist commented 2 years ago

72 Adds this

olahol commented 2 years ago

See #72