Skip to content

Commit

Permalink
Fixed websocket support in hs.httpserver:start()
Browse files Browse the repository at this point in the history
- Closes #3468
  • Loading branch information
latenitefilms authored and cmsj committed Nov 12, 2024
1 parent dbfd067 commit ca91c17
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion extensions/httpserver/libhttpserver.m
Original file line number Diff line number Diff line change
Expand Up @@ -583,7 +583,12 @@ static int httpserver_start(lua_State *L) {
LuaSkin *skin = [LuaSkin sharedWithState:L];
HSHTTPServer *server = getUserData(L, 1);

if (server.fn == LUA_NOREF) {
if (server.wsCallback != LUA_NOREF) {
NSError *error = nil;
if (![server start:&error]) {
[skin logError:[NSString stringWithFormat:@"hs.httpserver:start() Unable to start object: %@", error]];
}
else if (server.fn == LUA_NOREF) {
[skin logError:@"hs.httpserver:start() called with no callback set. You must call hs.httpserver:setCallback() first"];
} else {
NSError *error = nil;
Expand Down

0 comments on commit ca91c17

Please sign in to comment.