-
Notifications
You must be signed in to change notification settings - Fork 20
Server handshake response error: websocketpp.processor:20 (Invalid HTTP status.) #32
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
Comments
I am seeing the same:
There are two threads about this error in the underlying websocketpp library: |
Thank you for the reports. Can you please provide the following additional information?
I haven't seen or been able to reproduce this using any |
hi, I encountered this error message during the use of socket.io-client-cpp. The problem I encountered was that the ssl was not compiled, the https used when setting the url was wrong, and it returned to normal when I used http. Hope to be helpful to this problem . |
I faced the same problem when I shipped my solution to customer. Everything works on my side but fails with this error on customer. I had a server written in Python with Flask-Socketio using gevent. I reproduced the issue when I had a clean env and installed only packages that I was using: flask, flask-socketio, gevent. The error was happening to me as well. The issue got solved when I install gevent-websocket which was a finger-into-an-air solution. |
Hi... Any news about this issue??? |
ws$connect() |
For me using the encoded URL solved the problem. if the problematic url is: then following encoded url should work: |
how can i use streaming-graph.facebook.com Live Comments link show error :20 (Invalid HTTP status.) https://streaming-graph.facebook.com/{live-video-id}/live_comments?access_token=[user-access-token] I put in the browser chrome functions well url always have token activated |
I have the same error. I'm using Windows 10, MinGW 64-bit. I'm trying to connect to my server (see my server script below) which is hosted on the Render host at this address: std::string uri = "wss://connection-js.onrender.com"; When I use "wss://..." I see this error:
But this works locally: std::string uri = "ws://localhost:3000"; I tried to connect my Qt6 client to this server - it works for "wss://..." but does not work for "ws://...". main.cpp #define ASIO_STANDALONE
#define _WEBSOCKETPP_CPP11_THREAD_
#define _WEBSOCKETPP_CPP11_RANDOM_DEVICE_
#define _WEBSOCKETPP_CPP11_STRICT_
#define _WEBSOCKETPP_CPP11_TYPE_TRAITS_
#include <websocketpp/config/asio_no_tls_client.hpp>
#include <websocketpp/client.hpp>
typedef websocketpp::client<websocketpp::config::asio_client> client;
using websocketpp::lib::placeholders::_1;
using websocketpp::lib::placeholders::_2;
using websocketpp::lib::bind;
// pull out the type of messages sent by our config
typedef websocketpp::config::asio_client::message_type::ptr message_ptr;
// This message handler will be invoked once for each incoming message. It
// prints the message and then sends a copy of the message back to the server.
void on_message(client* c, websocketpp::connection_hdl hdl, message_ptr msg) {
std::cout << "on_message called with hdl: " << hdl.lock().get()
<< " and message: " << msg->get_payload()
<< std::endl;
websocketpp::lib::error_code ec;
c->send(hdl, msg->get_payload(), msg->get_opcode(), ec);
if (ec) {
std::cout << "Echo failed because: " << ec.message() << std::endl;
}
}
int main()
{
// Create a client endpoint
client c;
// std::string uri = "ws://localhost:3000";
std::string uri = "wss://connection-js.onrender.com";
try
{
// Set logging to be pretty verbose (everything except message payloads)
c.set_access_channels(websocketpp::log::alevel::all);
c.clear_access_channels(websocketpp::log::alevel::frame_payload);
// Initialize ASIO
c.init_asio();
// Register our message handler
c.set_message_handler(bind(&on_message,&c,::_1,::_2));
websocketpp::lib::error_code ec;
client::connection_ptr con = c.get_connection(uri, ec);
if (ec)
{
std::cout << "could not create connection because: " << ec.message() << std::endl;
return 0;
}
// Note that connect here only requests a connection. No network messages are
// exchanged until the event loop starts running in the next line.
c.connect(con);
// Start the ASIO io_service run loop
// this will cause a single connection to be made to the server. c.run()
// will exit when this connection is closed.
c.run();
} catch (websocketpp::exception const & e)
{
std::cout << e.what() << std::endl;
}
return 0;
} makefile
Server: const express = require("express");
const http = require("http");
const ws = require("ws");
const path = require("path");
const app = express();
app.use(express.static(path.join(process.cwd(), "public")));
const httpServer = http.createServer(app);
const wss = new ws.Server(
{
server: httpServer
});
const port = process.env.PORT || 3000;
httpServer.listen(port, () => console.log("Listening at port: " + port));
wss.on("connection", socket =>
{
console.log("client was connected");
}); This is the Qt client that works: main.cpp #include <QtCore/QDebug>
#include <QtWidgets/QApplication>
#include <QtWidgets/QWidget>
#include <QtWebSockets/QWebSocket>
class Window : public QWidget
{
Q_OBJECT
private:
QWebSocket m_webSocket;
public:
Window(QWidget *parent = nullptr)
: QWidget(parent)
{
setWindowTitle("Qt6 C++ Client");
resize(300, 300);
connect(&m_webSocket, &QWebSocket::connected,
this, &Window::onConnected);
// m_webSocket.open(QUrl("ws://localhost:3000"));
m_webSocket.open(QUrl("wss://connection-js.onrender.com"));
qDebug() << "Waiting for connection...";
}
private slots:
void onConnected()
{
qDebug() << "Client was connected to server";
}
};
#include "main.moc"
#ifdef _WIN32
#include <Windows.h>
#endif
int main(int argc, char *argv[])
{
#ifdef _WIN32
if (AttachConsole(ATTACH_PARENT_PROCESS))
{
freopen("CONOUT$", "w", stdout);
freopen("CONOUT$", "w", stderr);
}
#endif
QApplication a(argc, argv);
Window w;
w.show();
return a.exec();
} websocket-client-qt6-cpp.pro
|
The problem
|
I am able to reproduce the error using examples from readme library(websocket)
ws <- WebSocket$new("ws://echo.websocket.org/", autoConnect = FALSE)
ws$onOpen(function(event) {
cat("Connection opened\n")
})
ws$onMessage(function(event) {
cat("Client got msg: ", event$data, "\n")
})
ws$onClose(function(event) {
cat("Client disconnected with code ", event$code,
" and reason ", event$reason, "\n", sep = "")
})
ws$onError(function(event) {
cat("Client failed to connect: ", event$message, "\n")
})
ws$connect()
|
any solution or hints like what needs to be changed to solve this issue |
I'm getting this error! what to do now?

The text was updated successfully, but these errors were encountered: