@ aspnet / signalr не работает на производстве - PullRequest
0 голосов
/ 06 февраля 2019

Я создаю API-функцию Azure для серверной службы Azure для сигнализатора и доступа в угловом компоненте. Программа установки хорошо работает в среде разработки, но в производственной среде она не работает. У кого-нибудь есть какая-либо информация по этому вопросу или кто-то сталкивался с такой проблемой в SignalR.

signalr.service.ts

import { HubConnection,HubConnectionBuilder } from '@aspnet/signalr';
import * as signalR from '@aspnet/signalr';

export class SignalRService {

  private readonly _baseUrl: string = "https://xxxx.azurewebsites.net/api/";
  private hubConnection: HubConnection;

  constructor(private http: Http) {  }

  // Get connection string from signlar 
  private getConnectionInfo(): Observable<SignalRConnectionInfo> {

       let requestUrl = `${this._baseUrl}negotiate`;
       return this.http.get(requestUrl)
            .map(res => res.json());
   }

  // Initialize
  init() {
     console.log(`initializing SignalRService...`);
      this.getConnectionInfo().subscribe(info => {
         // console.log(`received info for endpoint ${info.accessToken}`);

          let options = {
                accessTokenFactory: () => info.accessToken
             };

             this.hubConnection = new HubConnectionBuilder()
                 .withUrl(info.url, options)
                .configureLogging(signalR.LogLevel.Information)
                .build();

            this.hubConnection.start().catch(err => 
            console.error(err.toString()));

           this.hubConnection.on('notify', (data: any) => {
                console.log(data)
         });

       });
   }

}

Вот сообщения об ошибках:

> SyntaxError: Unexpected token {
    at exports.runInThisContext (vm.js:53:16)
    at Module._compile (module.js:373:25)
    at Object.Module._extensions..js (module.js:416:10)
    at Module.load (module.js:343:32)
    at Function.Module._load (module.js:300:12)
    at Module.require (module.js:353:17)
    at require (internal/module.js:12:17)
    at Object.<anonymous> (D:\home\site\wwwroot\node_modules\ws\lib\websocket.js:11:27)
    at Module._compile (module.js:409:26)
    at Object.Module._extensions..js (module.js:416:10) ***/


...