Skip to content

This is a small app demo'ing the intercommunication between sockets connected to multiple sails instances.

License

Notifications You must be signed in to change notification settings

bberry6/sails_socket_test

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Sails_socket_test

Installation


  1. Install redis. All the settings for redis in my tests are just default
  2. Run npm install
  3. lift (at least) 2 instances of the sails app on different ports.

i.e.

PORT=9000 sails lift --dev &>./9000.log &

PORT=9001 sails lift --dev &>./9001.log &

Note: the trailing ampersand will background the application. Close the terminal or kill the application.

Testing


Once the two applications are running, open browser tabs with localhost:XXXX/ where XXXX are the ports that you have executed the sails applications on.

The "Room list" select menu lists the rooms that your specific socket is connected to. All websockets initially join a room with the name of their own socket id. You cannot leave this room.

You can join rooms with the input below.

The "message to send" will used for each of the 4 types of send buttons.

Currently, I have 6 separate (purposeful) test cases.

  1. Broadcast to a room that multiple websocket connections are in, regardless of which sails instance they're connected to. Passing

  2. Broadcast to a room that is the socket id of a separate websocket connection. Passing

  3. Blast to all websocket connections connected to all sails instances. Passing

  4. Emit to a specific websocket id that is not connected to the same instance (port) of the requesting websocket connection. Failing

  5. Get subscribers of a specific room does not list websocket ids that are not connected to the same sails instance as the requesting websocket connection. Failing

  6. Get subscribers of a room with a websocket id that is not connected to the same instance (port) of the requesting websocket connection. Failing

The 2nd test currently can be used as a work around to the 4th test failing.

Purpose

The purpose of all this is simply to display the effects of running multiple instances of the sails app and intercommunication of the websockets connections to those instances.

I have only tested all of this running on 1 physical machine, but theoretically as long as the applications can connect to a redis-server, it should work if the applications were on separate machines as well.

I am on #sailsjs irc as bberry. This has been created to support an issue on the sails github page.

License

Copyright (c) 2015 Brett Berry.

Released under the MIT licence.

About

This is a small app demo'ing the intercommunication between sockets connected to multiple sails instances.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published