Skip to content

Commit

Permalink
fix(ios): fix websocket function
Browse files Browse the repository at this point in the history
  • Loading branch information
ozonelmy authored and xuqingkuang committed Jun 30, 2020
1 parent e816c31 commit 987b08c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions ios/sdk/debug/websocket/HippyWebSocketManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ - (void)invalidate
NSNumber *socketId = @(socketIndex++);
[_sockets setObject:socket forKey:socketId];
resolve(@{@"code": @(0), @"id": socketId});
[socket open];
}

HIPPY_EXPORT_METHOD(close:(NSDictionary *)params) {
Expand All @@ -99,8 +100,7 @@ - (void)invalidate

- (void)webSocket:(HippySRWebSocket *)webSocket didReceiveMessage:(id)message {
dispatch_async(_queue, ^{
NSString *data = [[NSString alloc] initWithData:message encoding:NSUTF8StringEncoding];
[self sendEventType:@"onMessage" socket:webSocket data:data];
[self sendEventType:@"onMessage" socket:webSocket data:message];
});
}

Expand Down

0 comments on commit 987b08c

Please sign in to comment.