0

I'm using node.js with socketstream.Client side js files are not loading and also im getting ss is not defined error in client side while calling server method.

  This is my  app.js file

   var ss = require('socketstream'), 
  express = require('express');
  var app = express(); 
 // Code & Template Formatters 
 ss.client.formatters.add(require('ss-stylus')); 
 ss.client.templateEngine.use(require('ss-hogan')); 
   ss.client.define('main',
    { view: 'app.html', 
    css: ['libs/reset.css', 'app.styl'], 
   code: ['libs/jquery.min.js', 'app'], 
     tmpl: '*' }); 
 // Use Express to route requests 
  app.get('/', function(req, res){ 
  res.serveClient('main'); });
  server = app.listen(3000); 
  ss.start(server);
  // Append SocketStream middleware to the stack 
  app.stack = ss.http.middleware.stack.concat(app.stack);


   This is my server side method rpc method
     exports.actions = function(req, res, ss){

    return {

        saveUserInfo: function(name,pwd){
        console.log(name);
        console.log(pwd);
        res('name is '+name + '&'+'password is '+pwd);

      }

        }
       }
MAAAAANI
  • 186
  • 1
  • 10
  • While using ss in client side to call the server side method im getting ss not defined error.ss.rpc('saveUserInfo',name,pwd,function(req,res){}) – MAAAAANI Dec 31 '12 at 10:18

1 Answers1

0

The ss.rpc function takes the name of the rpc file, followed by the function name. So for example, if the file is called server/rpc/authentication.js, then you would call this from the client:

ss.rpc('authentication.saveUserInfo', name, pwd, function(response){
  console.log(response);
});
paulbjensen
  • 828
  • 7
  • 6