Edit This Page

publish(channel, payload)

Publish the event with the given payload on the given channel.


  • channel (String): define the channel on which payload will be passed
  • payload (any): value to pass to subscribers


refractionInstance.publish('newChatPartecipant', { username: 'example_user' });


  • Define a standard template for payload parameter. In this way middlewares can be defined easily and all can be clearer. For example:
    refractionInstance.publish('newChatPartecipant', {
      type: 'event',
      payload: e,