0.1.0 • Published 9 years ago

brsocket-angular2 v0.1.0

Weekly downloads
2
License
Apache 2.0
Repository
github
Last release
9 years ago

BRSocket-Angular2

Socket на angular2. Принимающий события из websocket-a.

Установка

npm i -S brsocket-angular2

Использование

import {SocketModule} from "brsocket-angular2";

@NgModule({
    imports: [
        ... 
        SocketModule
        ...
    ],
    declarations: [
        DemoComponent
    ]
})
export class Demo {
}
@Component({
    .....
})
export class DemoComponent {
    public messages: Message[];

    constructor(protected socket:SocketService) {
    }
    
    ngOnInit() {
        var self = this;
        this.socket.on('chat:message', function (message) {
            self.messages.push(message);
        }, Message);
    }
}