How to use ng2-signalr - 3 common examples

To help you get started, we’ve selected a few ng2-signalr examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github dimangulov / expenses / src / Expenses / Client / app / browser-app.module.ts View on Github external
return { cookie: document.cookie };
}

@NgModule({
    bootstrap: [AppComponent],
    imports: [
        BrowserModule.withServerTransition({
            appId: 'my-app-id' // make sure this matches with your Server NgModule
        }),
        BrowserAnimationsModule,
        BrowserTransferStateModule,

        // Our Common AppModule
        AppModule,

        SignalRModule.forRoot(createConfig)
    ],
    providers: [
        {
            // We need this for our Http calls since they'll be using an ORIGIN_URL provided in main.server
            // (Also remember the Server requires Absolute URLs)
            provide: ORIGIN_URL,
            useFactory: (getOriginUrl)
        }, {
            // The server provides these in main.server
            provide: REQUEST,
            useFactory: (getRequest)
        }
    ]
})
export class BrowserAppModule {
}
github TrilonIO / aspnetcore-angular-universal / ClientApp / app / containers / chat / chat.component.ts View on Github external
ngOnInit() {
      const onMessageSent$ = new BroadcastEventListener('OnMessageSent');
      this._connection.listen(onMessageSent$);
      this._subscription = onMessageSent$.subscribe((chatMessage: ChatMessage) => {
          this.chatMessages.push(chatMessage);
          console.log('chat messages', this.chatMessages);
      });
    }
github dimangulov / expenses / src / Expenses / Client / app / browser-app.module.ts View on Github external
export function createConfig(): SignalRConfiguration {
    const signalRConfig = new SignalRConfiguration();

    signalRConfig.hubName = 'Ng2SignalRHub';
    signalRConfig.qs = { user: 'donald' };
    signalRConfig.url = 'http://ng2-signalr-backend.azurewebsites.net/';
    signalRConfig.logging = true;

    return signalRConfig;
}