Comments (14)
You need to wait for the connection to establish, so instead of the line ws.send("test") do something like this:
ws.onopen=function(evt){
ws.send("test");
}
from simple-websocket-server.
No, That is resolving only
Failed to execute 'send' on 'WebSocket': Still in CONNECTING state.
That was understood.
But Handshake Error is still there
WebSocket connection to 'ws://localhost:8080/echo' failed: Connection closed before receiving a handshake response
from simple-websocket-server.
What browser do you use? This happens when you reload (and maybe leave) the page while having an open websocket connection. Just means that you have not closed it. To remove the message I guess you can do a ws.close() when the page unloads, but I do not know the JavaScript code for this.
from simple-websocket-server.
I am using chrome.
On Firefox it says
Firefox can't establish a connection to the server at ws://localhost:8080/echo.
I am not reloading or navigating away.
Web-socket connection is not being established I believe.
If it did , shouldn't I get trace in serve side ?
from simple-websocket-server.
Try this html file from a similar issue posted on this project:
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>WebSocket Test</title>
</head>
<body>
<script>
window.onload=function(){
var ws=new WebSocket("ws://localhost:8080/echo");
ws.onmessage=function(evt){console.log(evt.data);};
ws.onopen=function(evt){
ws.send("test");
setTimeout(function(){ws.close();}, 1000);
}
}
</script>
</body>
</html>
This one closes the connection after 1 sec, also the charset is set and its using the window.onload function. And yes you should see output on the terminal running ws_examples.
from simple-websocket-server.
Nah ! Same error. Is it still working at your system ? Please use the same steps as me.
If yes tell me the configs ?
from simple-websocket-server.
Yes this is working on Debian stable, testing and OS X. Do you get output when you start ./ws_examples
?
from simple-websocket-server.
Also please try cmake .;make;make test
and see if the tests are passed.
from simple-websocket-server.
You can also open the console in Chrome, and type in the JavaScript commands yourself:
var ws=new WebSocket("ws://localhost:8080/echo");
ws.onmessage=function(evt){console.log(evt.data);};
ws.send("test"); //try this line again if the connection is not up yet.
from simple-websocket-server.
I do not get anything on running ./ws_examples
When I do cmake, It ask for compiler 4.9.
I have 4.8.2 installed on Ubuntu 14. It was able to get compiled via traditional method.
from simple-websocket-server.
Strange you managed to compile it on g++ 4.8, I think regex was not supported before 4.9, and that is why you need g++ 4.9. I think it should be possible to install this on Ubuntu. Maybe do an upgrade on your system? g++ 4.9 is available in debian stable now, and should thus be installable on all its derivatives like Ubuntu (hopefully).
from simple-websocket-server.
I've made g++4.8 compilable fork but haven't updated code for a long time thou
from simple-websocket-server.
Okay , It seems the issue here then.
It was compiling with g++ 4.8.2 and running but not giving any traces.
But when compiled with 4.9 , it is running fine.
Thanks for your time.
Closing Issue :)
from simple-websocket-server.
I'm having this issue currently, and am running on windows.
Visual Studio 2015, I'm just pointing to Simple-WebSocket-Server
in AdditionalIncludeDirectories.
Any ideas on how I can get around this? Looks like I might just need to update visual studio
from simple-websocket-server.
Related Issues (20)
- [suggest] Send/Broadcast and Text/BinaryMode HOT 1
- Standalone Asio not found - but asio.hpp is present HOT 4
- re again WssClient::start causes on_error HOT 10
- When I use Google Chrome it happend a error. HOT 3
- exception thrown in server start (boost related) HOT 4
- Connection Timeout HOT 2
- Create example on how to stream data to a client HOT 1
- Unable to compile against standalone asio HOT 1
- How to stop the server? HOT 3
- Installed but ws_examples throws an error HOT 1
- Support for the Sec-WebSocket-Protocol field HOT 3
- fatal error C1083: Cannot open include file : 'pthread.h': No such file or directory HOT 1
- Messages split among frames aren't reasembled HOT 25
- Openssl wants void* instead of char* in 0x1000115fL HOT 1
- how to initiate send message from client HOT 3
- Client request error: End of file
- Access violation exeption HOT 3
- gdiplus
- Can't use wss client HOT 5
- Integration with Simple-Web-Server HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from simple-websocket-server.