1

I have created a Node Webkit application using SailsJS in back-end and AngularJS in front-end. I want to integrate audio-chat in my application using EasyRTC. I tried the demo application in my local. And it works fine. I am able to connect two users and do audio-chat. But when I started integrating the same in my application, I was unsuccessful. I could integrate the client-side but not the server-side. Here is my server side code:

var http    = require("http");              // http server core module
var express = require("express");           // web framework external module
var io      = require("socket.io");         // web socket external module
var easyrtc = require("easyrtc");           // EasyRTC external module

var httpApp = express();
httpApp.use(express.static(__dirname + "/static/"));
var webServer = server;
// Start Socket.io so it attaches itself to Express server
var socketServer = io.listen(webServer, {"log level":1});
// Start EasyRTC server
var rtc = easyrtc.listen(httpApp, socketServer);

I want to integrate this in my Sails code. But I am unable to do it because, when I start the application, the server will be running in 1337 port and I couldn't figure out where to write this code. Can anyone tell me how to fix my problem?

Any kind of help is appreciated. Thanks in advance.

jww
  • 97,681
  • 90
  • 411
  • 885
DivyaMenon
  • 311
  • 4
  • 19

1 Answers1

0

I think you're just looking for the express instance that is used by sails.js. You can find that at:

sails.hooks.http.app

Something like this might be what you want:

easyrtc.listen(sails.hooks.http.app, socketServer);
Travis Webb
  • 14,688
  • 7
  • 55
  • 109