x.websocket: workaround `for _, item in a_map{}` bug, causing panic (#8463)
parent
5746ac4dd4
commit
7eb7d042ec
|
@ -26,8 +26,9 @@ fn start_server() ? {
|
|||
|
||||
// on_message_ref, broadcast all incoming messages to all clients except the one sent it
|
||||
s.on_message_ref(fn (mut ws websocket.Client, msg &websocket.Message, mut m websocket.Server) ? {
|
||||
for _, cli in m.clients {
|
||||
mut c := cli
|
||||
// for _, cli in m.clients {
|
||||
for i, _ in m.clients {
|
||||
mut c := m.clients[i]
|
||||
if c.client.state == .open && c.client.id != ws.id {
|
||||
c.client.write(msg.payload, websocket.OPCode.text_frame) or {
|
||||
panic(err)
|
||||
|
|
Loading…
Reference in New Issue