Skip to content

Instantly share code, notes, and snippets.

@thebadger412
Created January 25, 2013 10:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thebadger412/4633233 to your computer and use it in GitHub Desktop.
Save thebadger412/4633233 to your computer and use it in GitHub Desktop.
#### serial rpc module ####
ss = require 'socketstream'
_ = require 'underscore'
dashboardController = ss.api.app.controllers.dashboard
Dashboard = ss.api.app.models.Dashboard
fetchUserFromSession = ss.api.fetchUserFromSession
exports.actions = (req, res, ss) ->
req.use 'session'
# I'm not going to port this RPC method to the HTTP API for now, I don't think there's much need for that ATM.
serial: ->
#ss.publish.channel "user_#{user._id}", 'widgetPositionsUpdated', {_id: dashboard._id, positions: data.positions}
#ss.publish.channel "user_#{51019b9b821cf8db0d000002}", 'transmission', {_id:"51019fe9357865660e000014", bigNumber: 313}
ss.publish.channel("user_<51019b9b821cf8db0d000002>", 'transmission', {_id: "51019fe9357865660e000014", bigNumber: 999});
ss.api.publish.channel("user_<51019b9b821cf8db0d000002>", 'transmission', {_id: "51019fe9357865660e000014", bigNumber: 999});
@paulbjensen
Copy link

Just a quick one, line 17 will work in an RPC file. Also, You'll need to remove the < and > from "user_<51019b9b821cf8db0d000002>".

Thirdly, how are you calling the 'serial' rpc command? From the browser or from the terminal with ss-console?

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