Skip to content
This repository was archived by the owner on May 14, 2024. It is now read-only.
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 12 additions & 11 deletions SocketIO.m
Original file line number Diff line number Diff line change
Expand Up @@ -234,19 +234,20 @@ - (void) sendEvent:(NSString *)eventName withData:(id)data
- (void) sendEvent:(NSString *)eventName withData:(id)data andAcknowledge:(SocketIOCallback)function
{
NSMutableDictionary *dict = [NSMutableDictionary dictionaryWithObject:eventName forKey:@"name"];

// do not require arguments
if (data != nil) {
[dict setObject:[NSArray arrayWithObject:data] forKey:@"args"];
}
@autoreleasepool {
// do not require arguments
if (data != nil) {
[dict setObject:[NSArray arrayWithObject:data] forKey:@"args"];
}

SocketIOPacket *packet = [[SocketIOPacket alloc] initWithType:@"event"];
packet.data = [SocketIOJSONSerialization JSONStringFromObject:dict error:nil];
packet.pId = [self addAcknowledge:function];
if (function) {
packet.ack = @"data";
SocketIOPacket *packet = [[SocketIOPacket alloc] initWithType:@"event"];
packet.data = [SocketIOJSONSerialization JSONStringFromObject:dict error:nil];
packet.pId = [self addAcknowledge:function];
if (function) {
packet.ack = @"data";
}
[self send:packet];
}
[self send:packet];
}

- (void) sendAcknowledgement:(NSString *)pId withArgs:(NSArray *)data
Expand Down