Guest User

Untitled

a guest
Oct 23rd, 2018
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. initialize() {
  2. this.io = window.require('socket.io')();
  3.  
  4. const options = { pingTimeout: 100000000000000000 };
  5.  
  6. const http = window.require('http');
  7. const ip = '127.0.0.1';
  8. const httpServer = http.createServer();
  9. httpServer.listen(55555, ip);
  10.  
  11. this.io.attach(httpServer, options);
  12. const namespace = this.io.of(`/blah`);
  13.  
  14. namespace.on('connection', socket => {
  15. console.log('emit connect');
  16. socket.emit('connected');
  17. });
  18. }
  19.  
  20. function openConnection(apiKey, amount, symbol, memo) {
  21.  
  22. var socket = io.connect('127.0.0.1:55555/blah');
  23.  
  24. socket.on('connected', () => {
  25. console.log('CONNECTED')
  26. });
  27. }
Add Comment
Please, Sign In to add comment