Available Actions

Home » Documentation » Available Actions

“Patterns are the language of our craft. They provide a shared vocabulary for us to communicate, innovate, and efficiently solve common challenges in software development.”

Erich Gamma

Overview

This package comes with some out-of-the-box Actions, but you can (and probably will need) build your own for your own needs by extending the existent ones or creating new. To learn more how to create your own, check here: Creating your own Actions.

Add Listener Action

Conveyor\Actions\AddListenerAction

Action responsible for adding listeners to a connection. This way messages will be filtered.

Structure:

{
    "action": "add-listener",
    "listen": "action-name"
}

Associate User to Fd

Conveyor\Actions\AssocUserToFdAction

Action responsible for associating users to connections.

Structure:

{
    "action": "assoc-user-to-fd-action",
    "userId": 1
}

Base (default)

Conveyor\Actions\BaseAction

This is the base action. Works like a ping pong, returning the message to the client who sent it.

Structure:

{
    "action": "base-action",
    "data": "message"
}

Notice that this action also works if you don’t send a JSON, forcing the action to be the base one.

Broadcast

Conveyor\Actions\BroadcastAction

This is for messages to be broadcasted on the context of the connection that dispatches it.

Structure:

{
    "action": "broadcast-action",
    "data": "message"
}

Channel Connect

Conveyor\Actions\ChannelConnectAction

Action used to connect to a channel.

Structure:

{
    "action": "channel-connect",
    "channel": "channel-name"
}

Channel Disconnect

Conveyor\Actions\ChannelDisconnectAction

Action used to disconnect from a channel.

Structure:

{
    "action": "channel-disconnect"
}

Fanout

Conveyor\Actions\FanoutAction

Action used to broadcast without context borders (to every client in the server).

Structure:

{
    "action": "fanout-action",
    "data": "message"
}