4

I have an ASP.NET Core 2.2 MVC project that has HTTPS enabled and targets Docker Linux containers. I have followed all the instructions at https://learn.microsoft.com/en-us/aspnet/core/tutorials/signalr?view=aspnetcore-2.2&tabs=visual-studio to enable SignalR in my project.

When the project is run I see the following SignalR-related log entries:

[2019-02-19T15:20:14.395Z] Information: Normalizing '/mainHub' to 'https://localhost:44392/mainHub'. Utils.ts:185:30

[2019-02-19T15:20:14.858Z] Information: WebSocket connected to wss://localhost:44392/mainHub?id=3RS_UsO7L20SQHgW4meRpQ. Utils.ts:185:30

WebSocket is not in the OPEN state insys-signalr-location.min.js:1:426

[2019-02-19T15:33:41.840Z] Error: Connection disconnected with error 'Error: WebSocket closed with status code: 1006 ().'. Utils.ts:179:21

Error: WebSocket closed with status code: 1006 (). WebSocketTransport.ts:130:16

Is there anything in particular I need to do to use SignalR with pace.js?

EDIT

Initially I thought this was a problem with Docker. After identifying the conflict with pace.js I reframed the question.

7
  • I've got a colleague who has worked on a similar project which uses SignalR with Docker / .Net Core. It definitely works, afraid I haven't seen this specific problem and it's hard to diagnose without more detail. Commented Feb 19, 2019 at 16:19
  • I wonder if you're colleague would be willing to share an example DockerFile for one of their projects. I'm a total newb to Docker. I'm not certain that this is a Docker configuration issue, but I suspect it is at this point. Commented Feb 19, 2019 at 16:28
  • Afraid it's all closed source :(. Does your code work if you debug it outside of Docker containers? If so, I strongly suspect it's to do with your docker network/ports. The easiest way to start with this is to map docker ports to your localhost to let them communicate. See medium.freecodecamp.org/… Commented Feb 19, 2019 at 16:41
  • Have you exposed the desired ports in the Dockerfile ? Commented Feb 19, 2019 at 16:50
  • 443 and 80 are exposed in the Dockerfile. Are there other ports that should be exposed? Commented Feb 19, 2019 at 17:05

1 Answer 1

3

Turns out that this was a conflict with pace.js. Running the following script before loading pace.js solved the problem:

<script>
    window.paceOptions = { ajax: { ignoreURLs: ['mainHub', '__browserLink', 'browserLinkSignalR'], trackWebSockets: false } }
</script>
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.