Error during WebSocket handshake: net::ERR_CONNECTION_RESET

4,640 views
Skip to first unread message

Sandeep M R

unread,
Mar 11, 2016, 9:57:04 AM3/11/16
to kurento
Hi,

I am trying to run the hello-world example. Below is my observation.

What works:
Run the application and access the UI from localhost:8080. Since the web page and backend(web socket service) is running on the same server, everything works well.

What doesn't work:
Seperate the UI and backend. Run spring-boot application using tomcat. Run the static web page on a different server(ex: using npm package http-server). This results in below error.

WebSocket connection to 'ws://localhost:8080/mediamanager' failed: Error during WebSocket handshake: net::ERR_CONNECTION_RESET

How can I get this working? Thank you for your time and help.

Best Regards,
Sandeep




Ivan Gracia

unread,
Mar 11, 2016, 12:57:58 PM3/11/16
to Kurento Public
Did you make any modifications? If you access from client A an application located in box B, you shouldn't see this message

ws://localhost:8080/mediamanager

You should see the url from box B.

Ivan Gracia



--
You received this message because you are subscribed to the Google Groups "kurento" group.
To unsubscribe from this group and stop receiving emails from it, send an email to kurento+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Sandeep M R

unread,
Mar 11, 2016, 1:07:13 PM3/11/16
to kur...@googlegroups.com

Client is running at 8082 and server is running at 8080. This server also has a copy of the same client in its resource\static. I modified handler's path from helloworld to mediamanager. It's running in http mode.
Now if client at 8080 can access the server, what can go wrong from 8082?

Kind Regards,
Sandeep

You received this message because you are subscribed to a topic in the Google Groups "kurento" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/kurento/Bw7aRHVIaB0/unsubscribe.
To unsubscribe from this group and all its topics, send an email to kurento+u...@googlegroups.com.

Ivan Gracia

unread,
Mar 11, 2016, 1:14:27 PM3/11/16
to Kurento Public
I don't understand what do you mean with this

Client is running at 8082 and server is running at 8080

Client is a browser, so it can't run on 8082. It can try to connect to 8082, though. Maybe we are using same name to refer to different things? Let's say Client for the browser, app for the Tomcat Spring-Boot based app, and server or KMS for Kurento, so we understand each other :-)

What server is running in 8080, the app server or KMS? Can you describe your setup and your network?



Ivan Gracia


Message has been deleted

Sandeep M R

unread,
Mar 14, 2016, 5:36:46 AM3/14/16
to kurento
Hello Ivan,

I am attaching the source code. Below are the steps to reproduce the issue:
  • Unzip the attached source code. Configure kms uri in application.java and ip camera's url in MediaChannelManager.java. run the application.
  • Now navigating to localhost:8098 and clicking on start button should show the camera's stream. It works fine till here.
  • Copy the content of \src\main\resources\static to a different folder. You can host it in a separate tomcat or use npm packages like http-server. Intention here is to run the UI code on any server other than the one in which the backend service is running. This will result in the below error in the java script side.


Best Regards,

Sandeep


On Friday, March 11, 2016 at 8:03:23 PM UTC+1, Sandeep M R wrote:
Yes sure :).
I referred to the java script and the html part as client, spring boot java application is the application server running on tomcat, and then these is KMS behind it. Here is a screenshot from the package explorer.

Inline image 1

The app server is running on ws://localhost:8080/mediamanager.
Inline image 2
Javascript code is hardcoded to connect to this url
Inline image 3

Now here is what I tried step by step.
- I opened up chrome and hit on http://localhost:8080. The client UI came up. I could connect to my app server and see the video on the UI.
- I now took a copy of the client code to a different folder. Did not modify anything. Used npm's http-server to run this java script on port 8082. When I hit on http://localhost:8082, the UI come up, but I got below error.


WebSocket connection to 'ws://localhost:8080/mediamanager' failed: Error during WebSocket handshake: net::ERR_CONNECTION_RESET

Does this approach make sense?

Best Regards,
Sandeep


Ivan Gracia




Ivan Gracia



To unsubscribe from this group and stop receiving emails from it, send an email to kurento+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to a topic in the Google Groups "kurento" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/kurento/Bw7aRHVIaB0/unsubscribe.
To unsubscribe from this group and all its topics, send an email to kurento+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "kurento" group.
To unsubscribe from this group and stop receiving emails from it, send an email to kurento+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to a topic in the Google Groups "kurento" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/kurento/Bw7aRHVIaB0/unsubscribe.
To unsubscribe from this group and all its topics, send an email to kurento+unsubscribe@googlegroups.com.

Ivan Gracia




Ivan Gracia



To unsubscribe from this group and stop receiving emails from it, send an email to kurento+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to a topic in the Google Groups "kurento" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/kurento/Bw7aRHVIaB0/unsubscribe.
To unsubscribe from this group and all its topics, send an email to kurento+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "kurento" group.
To unsubscribe from this group and stop receiving emails from it, send an email to kurento+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to a topic in the Google Groups "kurento" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/kurento/Bw7aRHVIaB0/unsubscribe.
To unsubscribe from this group and all its topics, send an email to kurento+unsubscribe@googlegroups.com.
service.zip
Auto Generated Inline Image 1

Ivan Gracia

unread,
Mar 14, 2016, 6:55:12 AM3/14/16
to Kurento Public
Well, you need to have something listening in port 8098. What are you trying to connect your client to?

Ivan Gracia




Ivan Gracia




Ivan Gracia



To unsubscribe from this group and stop receiving emails from it, send an email to kurento+u...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to a topic in the Google Groups "kurento" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/kurento/Bw7aRHVIaB0/unsubscribe.
To unsubscribe from this group and all its topics, send an email to kurento+u...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "kurento" group.
To unsubscribe from this group and stop receiving emails from it, send an email to kurento+u...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to a topic in the Google Groups "kurento" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/kurento/Bw7aRHVIaB0/unsubscribe.
To unsubscribe from this group and all its topics, send an email to kurento+u...@googlegroups.com.

Ivan Gracia




Ivan Gracia



To unsubscribe from this group and stop receiving emails from it, send an email to kurento+u...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to a topic in the Google Groups "kurento" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/kurento/Bw7aRHVIaB0/unsubscribe.
To unsubscribe from this group and all its topics, send an email to kurento+u...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "kurento" group.
To unsubscribe from this group and stop receiving emails from it, send an email to kurento+u...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to a topic in the Google Groups "kurento" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/kurento/Bw7aRHVIaB0/unsubscribe.
To unsubscribe from this group and all its topics, send an email to kurento+u...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "kurento" group.
To unsubscribe from this group and stop receiving emails from it, send an email to kurento+u...@googlegroups.com.

Sandeep M R

unread,
Mar 14, 2016, 7:18:17 AM3/14/16
to kur...@googlegroups.com
The source code which I attached in my previous post is running on 8098.
Another observation- My machine's public ip is 10.55.48.30. Connection works from http://localhost:8098/ but not from http://10.55.48.30/8098.
The same is applicable to all kurento-java examples. Have you experienced this before?

Best Regards,
Sandeep

Ivan Gracia

unread,
Mar 14, 2016, 7:44:16 AM3/14/16
to Kurento Public
You'll need to open that port (8098 in your case) to the outer world. Are you using AWS?

Ivan Gracia


Sandeep M R

unread,
Mar 14, 2016, 7:52:42 AM3/14/16
to kurento
I found the problem. The issue was related to cross origin request.
Looks like CrossOriginFilter.java(in my example) is getting applied only for http and https requests. I had to add the below code to make it work for cross origins.
registry.addHandler(handler(), "/mediamanager").setAllowedOrigins("*");

Best Regards,
Sandeep
Reply all
Reply to author
Forward
0 new messages