I have an angular app needing to communicate to a server using websockets.
In my mock typescript server, I have:

import {Server} from "ws";

var wsServer: Server = new Server({port: 8085});
console.log('ws on 8085');
wsServer.on('connection',
    websocket => websocket.send('first pushed message'));


this sends a message at connection time. I want to use a timer and simulate 
additional messages being sent.

*How do I do that?*


On the angular side, I have a service that provides for the reception of the 
data, 


setContextChannel(channel) {
    let ws = new WebSocket(channel);
    *ws*.onmessage = function(event) {
        console.log('ws', event.data);
    };

    *ws*.onerror = function(event) {
        console.log('ws error', event);
    }
}


just to get the above working how do I push more messages from the server?


-- 
You received this message because you are subscribed to the Google Groups 
"Angular and AngularJS discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to