Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SignalR Message Pack Client Library not running in browser when using Angular Cli #14253

Closed
QuinntyneBrown opened this issue Apr 23, 2019 · 4 comments

Comments

@QuinntyneBrown
Copy link

After importing MessagePackHubProtocol from @aspnet/signalr-protocol-msgpack inside of an Angular app using the Angular cli, the application will no longer run in the browser.

You will see the following exception in the console.

image

Steps to reproduce the behavior:

Clone and run the following app:
https://github.com/QuinntyneBrown/ng-signalr-protocol-msgpack-issue

or

  1. Create an angular app using the angular cli

  2. npm install @aspnet/signalr and @aspnet/signalr-protocol-msgpack

  3. In the app component, import HubConnectionBuilder from @aspnet/signalr

  4. In the app component, import MessagePackHubProtocolfrom @aspnet/signalr-protocol-msgpack

  5. In the app component, add a method called ngOnInit

  6. Inside the ngOnInit method, add the following code

    var connection = new HubConnectionBuilder()
    .withUrl("")
    .withHubProtocol(new MessagePackHubProtocol())
    .build();

  7. run the app with the console open, and you should see the error. The UI will be blank.

Expected behavior

You should see the standard angular cli default page.

@alan-agius4
Copy link
Collaborator

Kindly see: #8160 (comment)

Thanks,

@QuinntyneBrown
Copy link
Author

Thanks @alan-agius4

I added the following line to the bottom of polyfills.ts

(window as any).global = window;

I'm getting the following error when I run the app.

image

Should I create another issue?

@alan-agius4
Copy link
Collaborator

Related to the original issue.

See from more context: #9827 (comment)

@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 9, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants