mirror of
https://github.com/asterisk/asterisk.git
synced 2025-10-14 16:33:34 +00:00
Debug logging to help with WebSocket connection problems
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@394513 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -99,6 +99,8 @@ struct ast_json *ari_websocket_session_read(
|
||||
ast_websocket_fd(session->ws_session), -1);
|
||||
|
||||
if (res <= 0) {
|
||||
ast_log(LOG_WARNING, "WebSocket poll error: %s\n",
|
||||
strerror(errno));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -106,14 +108,21 @@ struct ast_json *ari_websocket_session_read(
|
||||
&payload_len, &opcode, &fragmented);
|
||||
|
||||
if (res != 0) {
|
||||
ast_log(LOG_WARNING, "WebSocket read error: %s\n",
|
||||
strerror(errno));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
switch (opcode) {
|
||||
case AST_WEBSOCKET_OPCODE_CLOSE:
|
||||
ast_debug(1, "WebSocket closed by peer\n");
|
||||
return NULL;
|
||||
case AST_WEBSOCKET_OPCODE_TEXT:
|
||||
message = ast_json_load_buf(payload, payload_len, NULL);
|
||||
if (message == NULL) {
|
||||
ast_log(LOG_WARNING,
|
||||
"WebSocket input failed to parse\n");
|
||||
}
|
||||
break;
|
||||
default:
|
||||
/* Ignore all other message types */
|
||||
|
Reference in New Issue
Block a user