angular-websocket
                                
                                 angular-websocket copied to clipboard
                                
                                    angular-websocket copied to clipboard
                            
                            
                            
                        URL is not valid
Why it gives me invalid url ?
I tried this :
var dataStream = $websocket('ws:://localhost:3000/api/students/testing');
and this :
var dataStream = $websocket('ws:://api/students/testing');
but it is no use
Now i'm in a different state
I changed my code to var dataStream = $websocket('ws://127.0.0.1:3030'); 
and it give me : WebSocket connection to 'wss://127.0.0.1:3030/' failed: Error in connection establishment: net::ERR_CONNECTION_REFUSED
Here is my grunt file :
  // Define the configuration for all the tasks
  grunt.initConfig({
    // Project settings
    websocket: {
       options: {
         port: 3030,
         handler: 'websockets/websocketHandler.js'
       },
       target: {}
     },
This is the latest error :
WebSocket connection to 'ws://localhost:3000/api/students/testing' failed: Error during WebSocket handshake: Unexpected response code: 200
Code :
var dataStream = $websocket('ws://localhost:3000/api/students/testing'); 
I have met ths same question,while connect to nodejs server written by sockjs.
//Mock websocket apis var echo = sockjs.createServer({sockjs_url: 'http://cdn.jsdelivr.net/sockjs/1.0.1/sockjs.min.js' }); echo.on('connection', function(conn){ console.log("sock is conn"); conn.on('data', function(message){ conn.write("already recived"); }); conn.on('close', function() {}); }); var server = http.createServer(app); echo.installHandlers(server, {prefix: '/echo'}); server.listen(18081);
And in my angular project, JS as follows
var dataStream = $websocket('ws://localhost:18081/echo'); dataStream.onMessage(function(message){ console.log(message); });
And I got the error
WebSocket connection to 'ws://localhost:18081/echo' failed: Error during WebSocket handshake: Unexpected response code: 200
I have seem the
TODO: Add SockJS support
is the reason that "Error in connection establishment" while connect to the nodejs server writen in sockjs?
same problem here. Any update on this ?
Are you able to connect to the WS endpoint with a different tool?
Same issue. Any solution here?