Skip to content

Commit 68d0690

Browse files
Merge pull request #108 from FelixTUD/dev-server-fixes
Fix for newer LibWebSocket versions
2 parents 48f3bf6 + 1f3f567 commit 68d0690

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

server/src/WebSocketDataConnector.cpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,10 @@ static int callback_isaac(
160160
case LWS_CALLBACK_RECEIVE:
161161
if (pss->client)
162162
{
163-
json_t* input = json_loads((const char *)in, 0, NULL);
163+
json_error_t error;
164+
json_t* input = json_loadb((const char *)in, len, 0, &error);
165+
if(!input)
166+
printf("JSON ERROR: %s", error.text);
164167
MessageContainer* message = new MessageContainer(NONE,input);
165168
int finish = (message->type == CLOSED);
166169
json_object_set_new( message->json_root, "url", json_string( pss->url ) );
@@ -172,6 +175,7 @@ static int callback_isaac(
172175

173176
case LWS_CALLBACK_FILTER_PROTOCOL_CONNECTION:
174177
{
178+
printf("callback_isaac: LWS_CALLBACK_FILTER_PROTOCOL_CONNECTION\n");
175179
char name[256];
176180
char rip[256];
177181
lws_get_peer_addresses(wsi,lws_get_socket_fd(wsi),name,256,rip,256);
@@ -206,7 +210,8 @@ errorCode WebSocketDataConnector::init(int port,std::string interface)
206210
{
207211
setlogmask(LOG_UPTO (LOG_DEBUG));
208212
openlog("lwsts", LOG_PID | LOG_PERROR, LOG_DAEMON);
209-
lws_set_log_level(7, lwsl_emit_syslog);
213+
int logs = LLL_USER | LLL_ERR | LLL_WARN | LLL_NOTICE;
214+
lws_set_log_level(logs, lwsl_emit_syslog);
210215
struct lws_context_creation_info info;
211216
memset(&info, 0, sizeof info);
212217
info.protocols = protocols;

0 commit comments

Comments
 (0)