WebSocket connection to 'ws://localhost:41000/' failed

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

WebSocket connection to 'ws://localhost:41000/' failed

Jump to solution
2,975 Views
Jayakanth
Contributor I

"Hello everyone,

I'm currently working on a tutorial titled 'Introduction to FreeMASTER Dashboard Coding Using HTML, JavaScript, ActiveX, and JSON-RPC.' During this project, I encountered an issue when attempting to read variables from my NXP board using the JSON-RPC method. The problem surfaced when I tried to open an HTML file in the Chrome browser, and upon inspecting the developer tools, I received the following error message: (freemaster-client.js):161 WebSocket connection to 'ws://localhost:41000/' failed. Subsequently, my JavaScript code threw an error with a status code of 1006.

I have tried various troubleshooting methods, but I have not been able to resolve the issue. If anyone has insights or suggestions on how to address this WebSocket connection error, I would greatly appreciate your guidance.

Thank you for your help.

0 Kudos
Reply
1 Solution
2,965 Views
MichalH
NXP Apps Support
NXP Apps Support

Hello, 

we have not heard about this issue before. I wonder if there could be a firewall which prevents connection to the localhost TCP port.

Very quick test is to run FreeMASTER and run "telnet localhost 41000" in a 'cmd' command line.  If you get a connection error, then I would bet someone (firewall) blocks the connection. If telnet connects well, then it will be an issue of Chrome engine and we will need to analyze it further.

Note: in telnet, a successful connection means you will get a blank screen without errors. By typing { } as an empty/invalid JSON-RPC command, you should get a response something like:

{"jsonrpc":"2.0","id":"","error":{"code":-32600,"message":"Unknown error"}}

 Regards,
Michal

View solution in original post

4 Replies
2,966 Views
MichalH
NXP Apps Support
NXP Apps Support

Hello, 

we have not heard about this issue before. I wonder if there could be a firewall which prevents connection to the localhost TCP port.

Very quick test is to run FreeMASTER and run "telnet localhost 41000" in a 'cmd' command line.  If you get a connection error, then I would bet someone (firewall) blocks the connection. If telnet connects well, then it will be an issue of Chrome engine and we will need to analyze it further.

Note: in telnet, a successful connection means you will get a blank screen without errors. By typing { } as an empty/invalid JSON-RPC command, you should get a response something like:

{"jsonrpc":"2.0","id":"","error":{"code":-32600,"message":"Unknown error"}}

 Regards,
Michal

2,894 Views
Jayakanth
Contributor I
Hello @MichalH,
I would like to express my gratitude for your support. It was a firewall issue that blocked Freemaster. I solved it by allowing the Freemaster main executable in Windows Defender Firewall, as a result, it began functioning correctly.
0 Kudos
Reply
2,933 Views
Jayakanth
Contributor I

Hello @MichalH,

We tried running the command 'telnet localhost 41000,' and it resulted in a black screen with the cursor positioned in the top left corner. When we attempted to type '{}', it immediately exited the black screen, preventing us from entering any commands. We initially suspected a firewall issue and even uninstalled the McAfee antivirus software, but the problem persisted.
It's worth noting that the same code and command work on different devices without any issues. As a result, we are currently at a loss and would appreciate any additional hints or troubleshooting suggestions.

0 Kudos
Reply
2,923 Views
MichalH
NXP Apps Support
NXP Apps Support

Hello,

please make sure that also the built-in Windows firewall is temporarily disabled to rule out that this is the issue.

Another experiment would be to run the FreeMASTER pcmaster.exe process with an argument /rpcs 50000 or a different port number and test it with telnet. Maybe the default 41000 is blocked by another process. 

Please let me know the result,

Thanks,
Michal

 

0 Kudos
Reply