2020-04-08 20:44:30 +03:00
|
|
|
module websocket
|
2020-04-08 15:22:31 +03:00
|
|
|
|
2020-07-05 18:44:33 +03:00
|
|
|
fn (ws &Client) send_message_event(msg &Message) {
|
2020-04-08 22:19:01 +03:00
|
|
|
ws.eb.publish('on_message', ws, msg)
|
2020-07-22 17:31:22 +03:00
|
|
|
ws.log.debug('sending on_message event')
|
2020-04-08 15:22:31 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
fn (ws &Client) send_error_event(err string) {
|
2020-04-08 22:19:01 +03:00
|
|
|
ws.eb.publish('on_error', ws, err)
|
2020-07-22 17:31:22 +03:00
|
|
|
ws.log.debug('sending on_error event')
|
2020-04-08 15:22:31 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
fn (ws &Client) send_close_event() {
|
2020-04-08 22:19:01 +03:00
|
|
|
ws.eb.publish('on_close', ws, voidptr(0))
|
2020-07-22 17:31:22 +03:00
|
|
|
ws.log.debug('sending on_close event')
|
2020-04-08 15:22:31 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
fn (ws &Client) send_open_event() {
|
2020-04-08 22:19:01 +03:00
|
|
|
ws.eb.publish('on_open', ws, voidptr(0))
|
2020-07-22 17:31:22 +03:00
|
|
|
ws.log.debug('sending on_open event')
|
2020-04-08 22:19:01 +03:00
|
|
|
}
|