Hello, 
i cant find a way to use websockets in angular2.
There is no documentation at all, i found 
this https://github.com/afrad/angular2-websocket
but i cant make it working

import { Component } from 'angular2/core';
import { $WebSocket } from 'angular2-websocket/angular2-websocket';

@Component
({
    selector: "interactive",
    templateUrl: "scripts/spa/templates/interactive-app.component.html",
    directives: [Panel]
})
export class InteractiveApp
{
    data: any;
    
    constructor()
    {
        var ws = new $WebSocket("ws://localhost:8888/websocket");
        ws.send("listening");
        ws.onMessage(this.handle_data)
        
    }
    
    handle_data(msg)
    {
        this.data = JSON.parse(msg.data);
        window.console.log(this.data);
    }
}


With this code i receive successfully the data, as the console.log shows 
me. But the "data" variable never changes...
I'm quite confused


-- 
You received this message because you are subscribed to the Google Groups 
"AngularJS" 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