Simplificator3000Phoenix.Channel (Simplificator3000 Phoenix v1.1.2)
Summary
Functions
Defines a message handler.
Permissions can be passed via opts
param to validate request's rights.
Event handler receives parsed and validated payload.
Defines a payload schema for first following message handler (that consumes the schema and prevents further use of this schema).
Payload schema is a map with keys and types.
For schema documentation see Tarams
library.
Functions
Defines a message handler.
Permissions can be passed via opts
param to validate request's rights.
Event handler receives parsed and validated payload.
Options
- `:unauthorized_handler` - function to be called when user is not authorized to perform the action.
- `:invalid_params_handler` - function to be called when params are invalid.
- `:permissions` - list of permissions to check.
Examples
1. As a function definition:
```
message event_name(payload, socket) do
# Code
end
```
2. As a function declaration:
```
message(
:event_name,
payload_template,
opts
)
def event_name(payload, socket) do
# Code
end
```
This way you can create event handler by yourself thus allowing you to make use of mupltiple function pattern matching.
Defines a payload schema for first following message handler (that consumes the schema and prevents further use of this schema).
Payload schema is a map with keys and types.
For schema documentation see Tarams
library.