Questions tagged [primus]

Primus provides a common low level interface to communicate in real-time using various of real-time frameworks available for Node.js.

Useful Links

40 questions
1
vote
2 answers

Node.js http.createServer throws TypeError: listener must be a function

index.js: var koa = require('koa') , Primus = require('primus.io') , http = require('http') , app = koa() , server = http.createServer(app); var primus = new Primus(server, { transformer: 'websockets', parser: 'JSON'…
user3413838
  • 310
  • 4
  • 14
1
vote
0 answers

Node handling Primus socket disconnect during substream write

If I have a (synchronous) process writing to a substream on a socket which disconnects during code execution, what's the best way to keep it from throwing the exception? (I'm listening to the socket's close/end/etc events to remove the block from…
1
vote
1 answer

Primus.io intercepting data on the server

I am using Primus.io with primus-emit, on an Express 4 server. I'm trying to find a way to hook into every message sent/received, including heartbeats, in order to track my active users, for another module of the application. (This is done using a…
naartjie
  • 1,505
  • 1
  • 9
  • 18
1
vote
1 answer

Node.js primus websocket clustering

Trying most of the websocket engines I've concluded that best way is using Primus (a universal wrapper for real-time frameworks) so to be able to test any websocket framework that may come around without changing my functionality. Even though that…
1
vote
1 answer

How to authenticate with express and socket.io with TOKENS and not with COOKIES.

I'm building a realtime mobile app (native) and I'm interested in starting the app from a user login screen and then move on. I figured I need Express + primus with socket.io (or sockjs) + passport.socketio + redis (not 100% sure I need redis yet)…
SudoPlz
  • 20,996
  • 12
  • 82
  • 123
0
votes
2 answers

How do I only render the updated stat - websockets

right now the entire div re-renders, but I am searching for a way to only re-render the updated statistic these are parts of what I have now updatestats.js document.querySelector("#submit").addEventListener("click", function (e) { let country =…
0
votes
1 answer

Primus call to nodejs server, primus file not found

I've set up an API with nodejs express for a real-time chat application. For it to be real-time I am using primus but I'm currently stuck at trying to connect primus to my frontend. I have a folder structure for the whole backend and then another…
0
votes
2 answers

How to get the value from a mongoose/mongodb document after using findOne()

I am making a poll app where on /createpoll you can fill in a new question and answer possibilities. On the index page you can vote on the poll. The live updates are done using Primus (websocket). The live.js file I use works as a hub to pass data…
0
votes
2 answers

appending image with websockets to pug file

I'm creating a small app with node.js and have stumbled upon a problem. I am trying to send an img to all users from my admin account. The problem is I can't seem to show my image through javascript appending to the div I made . Is it because I'm…
0
votes
1 answer

How to get spark instance on using Primus middleware

I have setup a Primus websocket service as below. http = require('http'); server = http.createServer(); Primus = require('primus'); primus = new Primus(server, { transformer: 'websockets', pathname: 'ws' }); primus.on('connection', function…
Joey Yi Zhao
  • 37,514
  • 71
  • 268
  • 523
0
votes
1 answer

Got a PrimusError when setting primus server with feathersjs

I followed this link(https://docs.feathersjs.com/real-time/primus.html) to create a websocket server by feathersjs-primus. Below is the app.configure code I am using: app.configure(primus({ transformer: 'websocket' }, function(primus) { // Do…
Joey Yi Zhao
  • 37,514
  • 71
  • 268
  • 523
0
votes
1 answer

How to use feathersjs-primus to setup websocket connection

I am trying to setup websocket by feathers js + primus following from this link: https://docs.feathersjs.com/real-time/primus.html. But I don't know how to get spark instance from primus in server side. Below is my server code: class…
Joey Yi Zhao
  • 37,514
  • 71
  • 268
  • 523
0
votes
1 answer

Real time chat app using Polymer and node

I have a node application using Polymer as front-end. The app runs behind an nginx reverse proxy, which deals with HTTPs etc using HTTP2. I am using cookie sessions with signed cookies. I now need to add a "real time chat" to the app; I thought that…
Merc
  • 16,277
  • 18
  • 79
  • 122
0
votes
2 answers

Has anyone used Primus with websockets behind aws Elastic Load Balancer?

I have a node.js application server running on port 80 and I recently added realtime messaging through Primus websockets transformer on port 9001. It works well in single instance. I deployed the messaging to Beanstalk environment with the following…
Skanda
  • 872
  • 13
  • 21
0
votes
1 answer

Using Primus instead of socket-io with simplewebrtc

I want to use Primus instead of socket-io with simplewebrtc. Can any one help me to convert the below code to use Primus? https://github.com/andyet/SimpleWebRTC/blob/master/socketioconnection.js