Giter VIP home page Giter VIP logo

socket.io-amqp's Introduction

socket.io-amqp

A Socket.IO Adapter for use with RabbitMQ and other AMQP services.

Build Status

NPM version

How to use

var io = require('socket.io')(3000);
var amqp_adapter = require('socket.io-amqp');
io.adapter(amqp_adapter('amqp://localhost'));

API

adapter(uri[, opts], [onNamespaceInitializedCallback])

uri is a string like amqp://localhost which points to your AMQP / RabbitMQ server. The amqp:// scheme is MANDATORY. If you need to use a username & password, they must be embedded in the URI.

The following options are allowed:

  • prefix: A prefix that will be applied to all queues, exchanges and messages created by socket.io-amqp.

  • queueName: The name of the rabbitmq queue to use listen in on the exchange. Must be unique. Default value is '' which means rabbitmq will auto generate a queue name for you that is unique.

  • channelSeperator: The delimiter between the prefix, the namespace name, and the room, the default is '#' for compatibility with socket.io-emitter, but if you don't use it,you should change it because # is a wildcard character in rabbitmq which means you may get cross chatter with other rooms.

  • onNamespaceInitializedCallback: This is a callback function that is called everytime sockets.io opens a new namespace. Because a new namespace requires new queues and exchanges, you can get a callback to indicate the success or failure here. This callback should be in the form of function(err, nsp), where err is the error, and nsp is the namespace. If your code needs to wait until sockets.io is fully set up and ready to go, you can use this.

  • useInputExchange option: This configures the use of 2 exchanges socket.io and socket.io-input where socket.io-input is a fanout exchange and socket.io is bound to it.

  • amqpConnectionOptions

socket.io-amqp's People

Contributors

barbara-degraaf avatar fracmak avatar gabrielcastro avatar genixpro avatar ramzes13 avatar sensibill-delivery avatar sgiacomel avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

socket.io-amqp's Issues

GPL vs MIT?

Hi there,

We are considering using this module but GPL 3 is not compatible with our legal department :) Are you fixed on GPL or would you consider changing to MIT? http://choosealicense.com/

Thanks

Callback called again after creation of a namespace

I know it's not documented in your README instructions, but I saw that a callback could be called to get confirmation that the connection to RabbitMQ has been completed. I'm using it at the moment only to output a confirmation message to my server logs.

However, I noticed these confirmation messages were being output twice as often as I had expected, which lead me to believe at first that I was running twice as many processes as I thought. However, after some digging I've found that each time I start a socketIO namespace in my code, AMQPAdapter(nsp) is called again, which leads to my callback also being called again. Since I was only adding a single namespace, this was causing twice the confirmation messages I had been expecting.

Again, no big deal since this functionality is not even documented, but thought I'd share this. One possible improvement I see to avoid confusion in the future is passing nsp.name as a second argument to the callback.

Socket.io v2 Breaks Adapter

Whenever using socket.io 2 or later, the adapter breaks because it does not have a method required for the interface. This adapter has to be used with socket.io 1.

Fix: Change package.json to say "socket.io": "~1.0.2" rather than "socket.io":"^1.0.2"

Socket.IO v3 and v4 compatibility

I just wanted to check if anyone works on Socket.IO version 3/4 compatibility ? There were some breaking changes in socket.io-adapter package and this adapter seems to be unable to broadcast messages at this point.

(I will have a look if I can adjust it to work with the newer version, but let me know if anyone already did the work)

Get all users connected across all nodes

Hi,

Is there a way to list all users connected to the socket cluster using this adapter?

Right now I'm doing this to list all the sockets:

io.of('/').connected

And this to list all the sockets for a given room:

io.of('/').adapter.rooms['roomID'].sockets

But this is only listing the sockets connected to the node where it's executed. I have tried several different ways to do this but the result is the same. I wonder if there is a way to get the global information across all the nodes or if I should do it manually.

[question] websocket multiplexing

Hi,

Q1:
I would like to create single web-socket to the broker, but publish/subscribe to multiple queues/topics. Is this supported?

Q2:
Any plans to support AMQP 1.0 protocol?

Thanks a lot for answer.

Ladislav

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.