Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

15 lines (11 sloc) 0.51 kb
-module(rabbit_websockets_util).
-export([publish_msg/3, basic_handler/1]).
-include_lib("amqp_client/include/amqp_client.hrl").
publish_msg(Exchange, Msg, RKey) ->
{ok, Connection} = amqp_connection:start(#amqp_params_direct{}),
{ok, Channel} = amqp_connection:open_channel(Connection),
Publish = #'basic.publish'{exchange = Exchange, routing_key = RKey},
amqp_channel:call(Channel, Publish, #amqp_msg{payload = term_to_binary(Msg)}),
ok.
basic_handler(Msg) ->
binary_to_term(Msg).
Jump to Line
Something went wrong with that request. Please try again.