Wss://eventsub-beta.wss.twitch.tv/ws 403 Forbiden with cURL

(Sorry for my English, please)

Hello, i’m trying to connect to EventSub with WebSocket in C++. So i’m using libcurl. And for test I’ve been trying to make request with cURL.

My command:

curl -i -H "Connection: Upgrade" -H "Upgrade: websocket" -H "Sec-WebSocket-Version: 13" -H "Sec-WebSocket-Key: SGVsbG8sIHdvcmxkIQ==" -H "Pragma: no-cache" -H "Cache-Control: no-cache" -H "Sec-WebSocket-Extensions: permessage-deflate; client_max_window_bits" eventsub-beta.wss.twitch.tv/ws

And output:

TP/1.1 403 Forbidden
Server: CloudFront
Date: Tue, 31 Jan 2023 09:17:38 GMT
Content-Type: text/html
Content-Length: 915
Connection: close
X-Cache: Error from cloudfront
Via: 1.1 4de92b206959ca8be7bbe63a0373ffe4.cloudfront.net (CloudFront)
X-Amz-Cf-Pop: WAW51-P2
X-Amz-Cf-Id: EkcTZJi9BoRW_gCeiyomObC-cM6F3iiYdQllNR6paXQZbGTh_9CADQ==

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<HTML><HEAD><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<TITLE>ERROR: The request could not be satisfied</TITLE>
</HEAD><BODY>
<H1>403 ERROR</H1>
<H2>The request could not be satisfied.</H2>
<HR noshade size="1px">
Bad request.
We can't connect to the server for this app or website at this time. There might be too much traffic or a configuration error. Try again later, or contact the app or website owner.
<BR clear="all">
If you provide content to customers through CloudFront, you can find steps to troubleshoot and help prevent this error by reviewing the CloudFront documentation.
<BR clear="all">
<HR noshade size="1px">
<PRE>
Generated by cloudfront (CloudFront)
Request ID: EkcTZJi9BoRW_gCeiyomObC-cM6F3iiYdQllNR6paXQZbGTh_9CADQ==
</PRE>
<ADDRESS>
</ADDRESS>
</BODY></HTML>

My C++ code you can find in this gist
And… outputs locks like… this:

......
recv failed: 10035
recv failed: 10035
recv failed: 10035
recv failed: 10035
recv failed: 10035
recv failed: 10035
recv failed: 10035
recv failed: 10035
recv failed: 10035
recv failed: 10035
recv failed: 10035
recv failed: 10035
recv failed: 10035
Connection closed
libcurl wants to close 132 now
* Connection #0 to host eventsub-beta.wss.twitch.tv left intact
* Closing connection 0
Press any key to continue . . . 

This means that there are no messages from the server.

What i do wrong?

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.