GithubHelp home page GithubHelp logo

ramzes13 / socket.io-amqp Goto Github PK

View Code? Open in Web Editor NEW

This project forked from sensibill/socket.io-amqp

0.0 2.0 0.0 49 KB

AMQP Adapter for Socket.io

License: GNU Lesser General Public License v3.0

JavaScript 96.69% Shell 3.31%

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.

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.