Probably easy but Socket stream pub/sub not working for me #340

thebadger412 opened this Issue Jan 15, 2013 · 14 comments


None yet
3 participants

I am trying to follow the guide here

but when I boot node and require socketstream

and I do

ss.publish. (press tab)

there are no such methods such as "channel" or "all" in publish so I don't know how to carry on with this guide..


paulbjensen commented Jan 15, 2013

Yep, so there are 2 API methods exposed: 1 inside of rpc files, and another for all other files. You'll need to call ss.api.publish.

Here is the linked section in that document:

Lol hi again..

Okay I might be going crazy here but in api there is no publish..


paulbjensen commented Jan 16, 2013

What file contains the call to ss.api.publish, and how is it being loaded (in a separate Node.js process to the SocketStream app, or as a require("./example_file") in the SocketStream app's codebase)?

I have created a file in /rpc called serial and in that just started playing with ss.api.publish

but it said no modules called publish..or it was undefined, so I started digging around

so then I just created a random directory on computer, installed SS

and then in node I can view all of ss's methods and when I look in publish or in api I cannot find anything we are talking about..

heres a gist

Hopefully you can see where I am looking, it doesn't appear that the channel method is anywhere?


paulbjensen commented Jan 16, 2013

The folder path needs to be server/rpc, then run node app.js.


paulbjensen commented Jan 20, 2013

Hi, just wanted to ask if changing the path of the file from rpc/serial.js to server/rpc/serial.js did the trick?

Hey man, I can't get access to my computer with it on till monday,

However I am having another issue with dashku you might be able to shed
light on..

I have tried this on 2 comps now and same error, both ubuntu.. going to try
windows soon..

cloned your dashku repo,

got mongo running

got redis running.. started it,
When I click sign up though with my data input the server crashes with this

Segmentation Fault (core dumped)
Just wondered if you have had this problem before?


On 20 January 2013 00:42, Paul Jensen wrote:

Hi, just wanted to ask if changing the path of the file from rpc/serial.js
to server/rpc/serial.js did the trick?

Reply to this email directly or view it on GitHub


paulbjensen commented Jan 20, 2013

Sorry, I'm in github-issues-driven development mode ;)

Luckily for you, I ran into this once. I believe it was to do with using npm modules being compiled against a older version of Node.js (0.8.12), then using a updated version of Node.js (0.8.16).

The suggestion here is to remove all modules in the app's node_modules folder ('rm -rf node_modules' works for me), then run 'npm install' again, then the app runs again.

owenb commented Jan 24, 2013

Hi @thebadger412

Please follow @paulbjensen's suggestion and let us know how you get on. If this is now working for you, please close the issue.

Okay hi, so I am sure I am doing this wrong, I am a total newb but really want to get it working if you could help me..

So I am using dashku and as @paulbjensen mentioned to me in an email, if I want to communicate with one of his widgets I would have to put the following code in /server/rpc/serial.js

ss = require('socketstream');"user_<MONGODB_ID_FOR_YOUR_USER>", 'transmission', {_id: "YOUR_WIDGET_ID", randomDataAttribute: randomDataValue});

So I created the "bigNumber" widget and found out all the relevant id's

so I have cloned his git and the only thing I have added is that one file in /server/rpc..

here is the entire contents of my file

ss = require('socketstream');"user_<51019b9b821cf8db0d000002>", 'transmission', {_id: "51019fe9357865660e000014", bigNumber: 212});

and when I run coffee I get the following error

Hopefully someone can just say.. oh no just add a semi colon and it all works wooo


paulbjensen commented Jan 24, 2013

Hi @thebadger412,

Files inside of the server/rpc folder need to be structured with this code:

exports.actions = (req,res,ss) ->

    example: ->'channelName','eventName', {data:'value'});

Take a look at this file in Dashku for reference:

Also note that ss is being inherited from exports.actions (req,res,ss), not the require at the top of the file.

I really appreciate the help but try as I might this thing will not work..

Okay so just so we are clear, the only thing I have done is cloned the dashku git and then created the big number widget.. nothing else

I am then creating this file "" in /server/rpc..

as you can see it has a few trials in there by me, all of them failed with the same error as before..
I am thinking there is something else I must have to do to make this work.. like do I need to put some code in the widget or something? because at the minute I just don't know what to do..

Like I want it so as soon as the server starts it sends this value to bigNumber..


paulbjensen commented Jan 25, 2013

Commented on the gist file.

Also, in relation to "Like I want it so as soon as the server starts it sends this value to bigNumber..", you'll need to make an RPC call somewhere (either from browser or terminal, or somewhere in the app.js file after the server is started and a port is listened on) - Here is the relevant document about RPC:

owenb commented Mar 14, 2013

Hi there

Can you let me know where we are with this? Please close the issue if this is now working for you.

owenb closed this Apr 3, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment