2020-04-08 19:44:30 +02:00
|
|
|
module websocket
|
2020-04-08 14:22:31 +02:00
|
|
|
|
2020-04-08 21:19:01 +02:00
|
|
|
fn (ws &Client) send_message_event(msg Message) {
|
|
|
|
ws.eb.publish('on_message', ws, msg)
|
|
|
|
l.d('sending on_message event')
|
2020-04-08 14:22:31 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
fn (ws &Client) send_error_event(err string) {
|
2020-04-08 21:19:01 +02:00
|
|
|
ws.eb.publish('on_error', ws, err)
|
|
|
|
l.d('sending on_error event')
|
2020-04-08 14:22:31 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
fn (ws &Client) send_close_event() {
|
2020-04-08 21:19:01 +02:00
|
|
|
ws.eb.publish('on_close', ws, voidptr(0))
|
|
|
|
l.d('sending on_close event')
|
2020-04-08 14:22:31 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
fn (ws &Client) send_open_event() {
|
2020-04-08 21:19:01 +02:00
|
|
|
ws.eb.publish('on_open', ws, voidptr(0))
|
|
|
|
l.d('sending on_open event')
|
|
|
|
}
|