SHARE
TWEET

Untitled

a guest Feb 16th, 2019 79 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. const Server = require('simple-websocket/server')
  2.  
  3. const server = new Server({port: 8181})
  4.  
  5. new Promise((resolve, reject) => {
  6.   server.on('connection', function(socket, request) {
  7.     resolve({socket, request})
  8.   })
  9. }).then(data => {
  10.   console.log(data)
  11. })
  12.    
  13. const Socket =  require('simple-websocket')
  14.  
  15. exports.test = function() {
  16.   const socket = new Socket('wss://localhost:8181')
  17.  
  18.   socket.on('connect', function() {
  19.     console.log('yes')
  20.   })
  21. }
  22.    
  23. WebSocket connection to 'wss://localhost:8181/' failed: Error in connection
  24. establishment: net::ERR_SSL_PROTOCOL_ERROR
  25.  
  26. bundle.js:6106 Uncaught Error: connection error to wss://localhost:8181
  27. at WebSocket.Socket.self._ws.onerror (bundle.js:6106)
  28. Socket.self._ws.onerror @ bundle.js:6106
  29. error (async)
  30. Socket @ bundle.js:6105
  31. exports.test @ bundle.js:2841
  32. 9../middleware-comms/Listen @ bundle.js:2836
  33. o @ bundle.js:1
  34. r @ bundle.js:1
  35. (anonymous) @ bundle.js:1
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top