diff --git a/README.md b/README.md index 2d474ad..8a5111a 100644 --- a/README.md +++ b/README.md @@ -29,8 +29,8 @@ SocketIOClient* socket = [[SocketIOClient alloc] initWithSocketURL:@"localhost:8 [socket on: @"connect" callback: ^(NSArray* data, void (^ack)(NSArray*)) { NSLog(@"connected"); - [socket emitObjc:@"echo" withItems:@[@"echo test"]]; - [socket emitWithAckObjc:@"ackack" withItems:@[@1]](10, ^(NSArray* data) { + [socket emit:@"echo" withItems:@[@"echo test"]]; + [socket emitWithAck:@"ackack" withItems:@[@1]](10, ^(NSArray* data) { NSLog(@"Got ack"); }); }]; @@ -103,9 +103,9 @@ Methods 1. `on(name:String, callback:((data:NSArray?, ack:AckEmitter?) -> Void))` - Adds a handler for an event. Items are passed by an array. `ack` can be used to send an ack when one is requested. See example. 2. `onAny(callback:((event:String, items:AnyObject?)) -> Void)` - Adds a handler for all events. It will be called on any received event. 3. `emit(event:String, _ items:AnyObject...)` - Sends a message. Can send multiple items. -4. `emitObjc(event:String, withItems items:[AnyObject])` - `emit` for Objective-C +4. `emit(event:String, withItems items:[AnyObject])` - `emit` for Objective-C 5. `emitWithAck(event:String, _ items:AnyObject...) -> (timeout:UInt64, callback:(NSArray?) -> Void) -> Void` - Sends a message that requests an acknowledgement from the server. Returns a function which you can use to add a handler. See example. Note: The message is not sent until you call the returned function. -6. `emitWithAckObjc(event:String, withItems items:[AnyObject]) -> (UInt64, (NSArray?) -> Void) -> Void` - `emitWithAck` for Objective-C. Note: The message is not sent until you call the returned function. +6. `emitWithAck(event:String, withItems items:[AnyObject]) -> (UInt64, (NSArray?) -> Void) -> Void` - `emitWithAck` for Objective-C. Note: The message is not sent until you call the returned function. 7. `connect()` - Establishes a connection to the server. A "connect" event is fired upon successful connection. 8. `connectWithParams(params:[String: AnyObject])` - Establishes a connection to the server passing the specified params. A "connect" event is fired upon successful connection. 9. `close(#fast:Bool)` - Closes the socket. Once a socket is closed it should not be reopened. Pass true to fast if you're closing from a background task. diff --git a/SocketIOClientSwift/SocketIOClient.swift b/SocketIOClientSwift/SocketIOClient.swift index 2236c0b..b6a5a2f 100644 --- a/SocketIOClientSwift/SocketIOClient.swift +++ b/SocketIOClientSwift/SocketIOClient.swift @@ -280,7 +280,7 @@ public final class SocketIOClient: NSObject, SocketEngineClient, SocketLogClient /** Same as emit, but meant for Objective-C */ - public func emitObjc(event:String, withItems items:[AnyObject]) { + public func emit(event:String, withItems items:[AnyObject]) { if !self.connected { return } @@ -305,7 +305,7 @@ public final class SocketIOClient: NSObject, SocketEngineClient, SocketLogClient /** Same as emitWithAck, but for Objective-C */ - public func emitWithAckObjc(event:String, withItems items:[AnyObject]) -> OnAckCallback { + public func emitWithAck(event:String, withItems items:[AnyObject]) -> OnAckCallback { if !self.connected { return self.createOnAck(event, items: items) }