Skip to content

Latest commit

 

History

History
39 lines (26 loc) · 878 Bytes

File metadata and controls

39 lines (26 loc) · 878 Bytes

Events

With event method you're able to:

  • Publish global events to which other sockets can subscribe

Import

const {event} = new Server(ctx)

Methods

Name Description
event.publish Publish global event

event.emit(name, payload?)

Type Name Default Description
string name null Event name
object payload null Additional data passed with event

Emiting event

event.emit('email_sent', {to: '[email protected]'})

Catching event in socket.yml

event_handlers:
  events.socket_name.email_sent:
    file: email-sent.js