MC60 websocket connection error

AT+QIOPEN=“TCP”,“XXX.XXX.XX.XXX”,5001
AT+QISEND=349

POST / HTTP/1.1
Host: XXX.XXX.XX.XXX
Content-Type: application/json
Content-Length: 255

{“Operator”:null,“Kullanici”:{“RolId”:null,“Password”:“000XXXXQ”,“Username”:“xxxyy0029”},“Parametre”:[{“Aci”:11,“Hiz”:“100”,“Tarih”:“2025-01-08T15:40:43”,“KartId”:“SOFOR41”,“Kaynak”:null,“KonumX”:“49.32955704”,“KonumY”:“20.45859528”,“CihazId”:“abcdefg”}]}

When I try to make the above request using WebSocket, I receive the following warnings:

I cannot establish a WebSocket connection. I would appreciate your support regarding this issue.

HTTP/1.1 200 OK
Content-Type: text/html; charset=utf-8
Date: Fri, 10 Jan 2025 06:50:07 GMT
Server: Kestrel
Transfer-Encoding: chunked

80d

Hi Mikro, I can not understand what the ERROR is through this log.

Merhaba,

Based on my review of the AT command sets and app notes, the MC60’s AT command set doesn’t directly support WebSocket. So:

AT+QIOPEN, AT+QISEND only open raw TCP/UDP sockets.
AT+QHTTP… commands are for classic HTTP GET/POST.

There’s no specific AT command for WebSocket. Your application must handle handshake and framing on the MCU side.

If you want to use WebSocket ;

Open TCP with AT+QIOPEN.
Send a handshake GET as the first message:
GET /ws HTTP/1.1\r
Host: xxx.xxx.xx.xxx\r
Upgrade: websocket\r
Connection: Upgrade\r
Sec-WebSocket-Version: 13\r
Sec-WebSocket-Key: dGhlIHNhbXBsZSBub25jZQ==\r
\r

The server should return 101 Switching Protocols.
Then, the MCU code should generate the WebSocket frames (mask, opcode, length) itself and send them raw with AT+QISEND.
So, the MC60 is essentially the raw carrier, and you must code the WebSocket protocol layer yourself.

My recommendation is to use QHTTPPOST if your endpoint only expects JSON POSTs. It’s much simpler and doesn’t suffer from fragmentation. If you need a WebSocket, you’ll need to implement the WebSocket framework on the MCU side.

Quectel_MC60_AT_Commands_Manual_V1.4.pdf (1.4 MB)