V
V
Vlad Timofeev2015-02-17 18:54:04
JavaScript
Vlad Timofeev, 2015-02-17 18:54:04

How to get client request in socket.io?

Good day. Suppose when rendering jade-file an object with fields user, post, title , ect is given. How to get this object in socket.io when connecting?

var io = require('socket.io')(http);
  io.on('connection', function (socket) {
             // there to get a client request / or server object for page rendering
             .....

I will be very grateful)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander Prozorov, 2015-02-19
@Staltec

io.on('connection', function (socket) {
  //socket.request - request
  //socket.request.res - response
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question