How to see socket.io version on node.js npm server

I want to confirm that I have to switch to socket.io 0.7, my current application will not work on this server? if i update.

For this, I want to see my current version of socket.io, how can I see it?

and also, on the other hand, I want to go for a stable version of node, we currently have v0.5.0 pre, I want to go for a stable version for socket.io, I read a question about the stack, but did not find that question, viewing stable versions for working with socket.io,

will this affect my current application, if so, then should I update it on another server?

+6
source share
3 answers

For this, I want to see my current version of socket.io, how can I see what?

just open node.js interactively by simply typing node . Then you require('socket.io') . This way you will see a lot of information. If you just want to find out your version number, you can do require('socket.io').version .

 alfred@alfred-laptop :~/node/contact$ node > require('socket.io'); { version: '0.7.6', protocol: 1, clientVersion: '0.7.3', listen: [Function], Manager: { [Function: Manager] defaultTransports: [ 'websocket', 'htmlfile', 'xhr-polling', 'jsonp-polling' ], static: { cache: {}, paths: [Object], mime: [Object] } }, Transport: [Function: Transport], Socket: [Function: Socket], Store: { [Function: Store] Client: [Function] }, MemoryStore: { [Function: Memory] Client: [Function: Client] }, RedisStore: { [Function: Redis] Client: [Function: Client] }, parser: { packets: [ 'disconnect', 'connect', 'heartbeat', 'message', 'json', 'event', 'ack', 'error', 'noop' ], reasons: [ 'transport not supported', 'client not handshaken', 'unauthorized' ], advice: [ 'reconnect' ], encodePacket: [Function], encodePayload: [Function], decodePacket: [Function], decodePayload: [Function] } } 

required ('Socket.io'). Version '0.7.6'

and also on the other hand I want to go for a stable version of node, currently we have v0.5.0 pre, I want to go stable for socket.io I read in stackoverflow question, but I don’t find that question, viewing stable version for working with socket .io,

will this affect my current application, if so, then should I upgrade to another server?

node.js are native pent-up executables, and you can install multiple versions of node without any problems. You should take a look at nvm or nave to help you manage multiple versions of node.js. Thanks to this, you can easily run various applications in different versions of node.js / npm.

For example, right now node.js is running node v0.4.9 by default

 alfred@alfred-laptop :~/node/contact$ nvm ls v0.1.100 v0.1.16 v0.1.23 v0.1.30 v0.1.93 v0.2.0 v0.3.0 v0.3.7 v0.4.4 v0.1.101 v0.1.17 v0.1.24 v0.1.31 v0.1.94 v0.2.1 v0.3.1 v0.3.8 v0.4.5 v0.1.102 v0.1.18 v0.1.25 v0.1.32 v0.1.95 v0.2.2 v0.3.2 v0.4 v0.4.6 v0.1.103 v0.1.19 v0.1.26 v0.1.33 v0.1.96 v0.2.3 v0.3.3 v0.4.0 v0.4.7 v0.1.104 v0.1.20 v0.1.27 v0.1.90 v0.1.97 v0.2.4 v0.3.4 v0.4.1 v0.4.8 v0.1.14 v0.1.21 v0.1.28 v0.1.91 v0.1.98 v0.2.5 v0.3.5 v0.4.2 v0.4.8-rc v0.1.15 v0.1.22 v0.1.29 v0.1.92 v0.1.99 v0.2.6 v0.3.6 v0.4.3 v0.4.9 stable: v0.4.9 latest: v0.4.9 current: v0.4.9 default -> v0.4.9 # use 'nvm sync' to update from nodejs.org alfred@alfred-laptop :~/node/contact$ node -v v0.4.9 

To change the version, I just type nvm use v0.4.8, which I also installed.

 alfred@alfred-laptop :~/node/contact$ nvm use v0.4.8 Now using node v0.4.8 alfred@alfred-laptop :~/node/contact$ node -v v0.4.8 
+10
source

The above answer now does not work for the latest versions of the Socket.io library. Please see below the link to the latest answer for a version of socket.io:

 require('socket.io/package').version; 

Socket.IO Release

+6
source

To find out what the current version is, just run npm list socket.io in the current project at the command prompt.

+4
source

Source: https://habr.com/ru/post/892521/


All Articles