MegaBits/SIOSocket
关于
实时 iOS 应用框架(客户端) http://socket.io
网站与应用开发实测星标增长
- 24小时
- 0
- 7天
- 0
- 15天
- 0
- 1个月
- 正在收集历史
各周期内的星标净变化,周期相互重叠,并非每日新增。缺失的测量保持空白。星标代表关注度,不代表软件质量。
README.md
原文SIOSocket
SIOSocket is simple interface for communicating with Socket.IO 1.0 from iOS.
There is now a first-party iOS client for Socket.IO! (Therefore, this library is no longer being actively developed.) Congrats to the Socket.IO team for a job well done.
How to use
SIOSocket can be added as a CocodaPod, submodule, or standalone dependency to any iOS 7.0 (or greater) project.
pod 'SIOSocket', '~> 0.2.0'
then...
#import <SIOSocket/SIOSocket.h>
// ...
[SIOSocket socketWithHost: @"http://localhost:3000" response: ^(SIOSocket *socket) {
self.socket = socket;
}];
or, in Swift...
// ...
SIOSocket.socketWithHost("http://localhost:3000") { (socket: SIOSocket) in
self.socket = socket
}
A full demo can be found over at MegaBits/WorldPin
Types
typedef NSArray SIOParameterArray
An NSArray of these JSValue-valid objects:
- NSNull
- NSString
- NSNumber
- NSDictionary
- NSArray
- NSData
Generators
+ (void)socketWithHost:response:
Generates a new SIOSocket object, begins its connection to the given host, and returns it as the sole parameter of the response block.
The host reachable at the given URL string should be running a valid instance of a socket.io server.
+ (void)socketWithHost:reconnectAutomatically:attemptLimit:withDelay:maximumDelay:timeout:withTransports:response:
reconnectAutomaticallywhether to reconnect automatically (YES)attemptLimitnumber of times to attempt a reconnect (Infinite)reconnectionDelayhow long to wait before attempting a new reconnection (1)maximumDelaymaximum amount of time to wait between reconnections (5). Each attempt increases the reconnection by the amount specified byreconnectionDelay.timeoutconnection timeout before anonReconnectionErrorevent is emitted (20)withTransportsspecifies an array of transports for engine.io (default is 'polling', 'websocket').
Properties
void (^onConnect)()
Called upon connecting.
void (^onDisconnect)()
Called upon a disconnection.
void (^onError)(NSDictionary *errorInfo)
Called upon a connection error.
void (^onReconnect)(NSInteger numberOfAttempts)
Called upon a successful reconnection.
void (^onReconnectionAttempt)(NSInteger numberOfAttempts)
Called upon an attempt to reconnect.
void (^onReconnectionError)(NSDictionary *errorInfo)
Called upon a reconnection attempt error.
Responders
-(void)on:callback:
Binds the given void (^)(SIOParameterArray *) block, function, to the given event.
function is called upon a firing of event.
Emitters
-(void)emit:args:
Fires the given event with then given SIOParameterArray as arguments.
License
MIT
探索相关项目
加载中…