MSServerSentEvents:服务器发送事件的Objective-C实现

时间:2024-06-10 08:16:58
【文件属性】:

文件名称:MSServerSentEvents:服务器发送事件的Objective-C实现

文件大小:348KB

文件格式:ZIP

更新时间:2024-06-10 08:16:58

Objective-C

MSServerSentEvents 的Objective-C实现 用法 只需初始化一个事件源,然后订阅即可接收事件: NSMutableURLRequest *request = [ NSMutableURLRequest requestWithURL: @" http://127.0.0.1:8888/ " ]; MSServerSentEventsSource *serverSentEventsSource = [[MSServerSentEventsSource alloc ] initWithRequest: request receive: ^(MSServerSentEvent *event) { NSLog ( @" received: %@ " ,event); } completion: ^{ NSLog ( @" closed " ); } failure:


网友评论