Hi, I’ve got from the source code that ActionCable::Server
API allows to use custom coders for messages or even not use the default ActiveSupport::JSON
coder at all:
# ActionCable::Server::Broadcasting
def broadcast(broadcasting, message, coder: ActiveSupport::JSON)
broadcaster_for(broadcasting, coder: coder).broadcast(message)
end
...
def broadcaster_for(broadcasting, coder: ActiveSupport::JSON)
Broadcaster.new(self, String(broadcasting), coder: coder)
end
But if I use broadcasting from channel I don’t have any ability to provide other coder
# ActionCable::Channel::Broadcasting
def broadcast_to(model, message)
ActionCable.server.broadcast(broadcasting_for(model), message)
end
I think it would be fine to add that ability and also ability to set custom coder for a channel and the whole app via settings.