phoenix framework custom channels

jesuisbonbon

Im looking for a way to implement custom channels in the phoenix framework I don't want to use the topics but do routing based on payload.

For example i have a json message like this

{
    "command":"hello",
    "payload": {
                 "message_id":"001",
                 "body":"is it me your looking for"
               }
    }
}

and want to do routing based on the value of "command", and i have no clue where to start. i can not send topics because i want to use a existing api.

Chris McCord

You can do this by implementing your own Transport serializer (https://github.com/phoenixframework/phoenix/blob/master/lib/phoenix/transports/serializer.ex) and translating your client message format to the %Phoenix.Socket.Message{} format with topic, event, payload. See the built-in websocket serializer as a starting point for adaptation: https://github.com/phoenixframework/phoenix/blob/master/lib/phoenix/transports/websocket_serializer.ex

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Custom attributes errors in phoenix framework

From Dev

Custom attributes errors in phoenix framework

From Dev

Phoenix Framework Channels - (ErlangError) erlang error: [reason: :function_clause, mfa: {Phoenix.Endpoint.CowboyHandler

From Dev

Phoenix Framework Channels - (ErlangError) erlang error: [reason: :function_clause, mfa: {Phoenix.Endpoint.CowboyHandler

From Dev

Phoenix Framework: How to Route Custom Media Type?

From Dev

Use custom serializer like MessagePack with Phoenix Framework

From Dev

Phoenix channels polyfills

From Dev

Elixir + Phoenix Channels memory consumption

From Dev

Using Phoenix Channels Cross Origin

From Dev

How to add a custom error message for a required field in Phoenix framework

From Dev

How to apply a custom validation rule to a model in phoenix framework

From Dev

How to properly use leave/disconnect in Phoenix channels?

From Dev

Phoenix channels: send push to a particular client

From Dev

Only authenticating some channels on join in Phoenix

From Dev

Permament cookies in Phoenix Framework

From Dev

Phoenix framework & passing conn

From Dev

KeyError in Phoenix web framework

From Dev

Phoenix Framework callbacks

From Dev

Dynamic routes in Phoenix Framework

From Dev

Random router in Phoenix framework

From Dev

Truncate text in Phoenix Framework

From Dev

Phoenix framework distribution

From Dev

Use Custom Fonts in Phoenix

From Dev

How do I create and integrate a set of custom templates into the Phoenix Framework (Elixir)

From Dev

Bot Framework Exception Handling in Channels?

From Dev

How to use Phoenix Channels / Sockets in an Angular 2 app?

From Dev

Phoenix Channels - broadcasting from controller - how to find current_user?

From Dev

Phoenix + Channels: How to ensure that both parties have "accepted"?

From Dev

full text search for phoenix framework

Related Related

  1. 1

    Custom attributes errors in phoenix framework

  2. 2

    Custom attributes errors in phoenix framework

  3. 3

    Phoenix Framework Channels - (ErlangError) erlang error: [reason: :function_clause, mfa: {Phoenix.Endpoint.CowboyHandler

  4. 4

    Phoenix Framework Channels - (ErlangError) erlang error: [reason: :function_clause, mfa: {Phoenix.Endpoint.CowboyHandler

  5. 5

    Phoenix Framework: How to Route Custom Media Type?

  6. 6

    Use custom serializer like MessagePack with Phoenix Framework

  7. 7

    Phoenix channels polyfills

  8. 8

    Elixir + Phoenix Channels memory consumption

  9. 9

    Using Phoenix Channels Cross Origin

  10. 10

    How to add a custom error message for a required field in Phoenix framework

  11. 11

    How to apply a custom validation rule to a model in phoenix framework

  12. 12

    How to properly use leave/disconnect in Phoenix channels?

  13. 13

    Phoenix channels: send push to a particular client

  14. 14

    Only authenticating some channels on join in Phoenix

  15. 15

    Permament cookies in Phoenix Framework

  16. 16

    Phoenix framework & passing conn

  17. 17

    KeyError in Phoenix web framework

  18. 18

    Phoenix Framework callbacks

  19. 19

    Dynamic routes in Phoenix Framework

  20. 20

    Random router in Phoenix framework

  21. 21

    Truncate text in Phoenix Framework

  22. 22

    Phoenix framework distribution

  23. 23

    Use Custom Fonts in Phoenix

  24. 24

    How do I create and integrate a set of custom templates into the Phoenix Framework (Elixir)

  25. 25

    Bot Framework Exception Handling in Channels?

  26. 26

    How to use Phoenix Channels / Sockets in an Angular 2 app?

  27. 27

    Phoenix Channels - broadcasting from controller - how to find current_user?

  28. 28

    Phoenix + Channels: How to ensure that both parties have "accepted"?

  29. 29

    full text search for phoenix framework

HotTag

Archive