Defines a connection listener that wraps an SLConnectionListener so that the callbacks are returned on the main GUI thread.
You can pass an SLConnectionListenerWrapper to [SLStreamLink addconnectionListener] in place of an SLConnectionListener. This allows you to update the GUI from within the wrapped SLConnectionListener's callback methods, without having to write boiler-plate code for accessing the GUI thread.
- See also
- SLSubscriptionListenerWrapper
The following example shows how to create and use an SLConnectionListenerWrapper:
#import <StreamLink/StreamLink.h>
@interface ExampleUsingSLConnectionListenerWrapper : NSObject<SLConnectionListener> {
}
@end
@implementation ExampleUsingSLConnectionListenerWrapper
-(void)connectToServer
{
[streamLink connect];
}
-(void)connectionStatus:(id<SLConnectionStatusEvent>) connectionStatusEvent
{
NSLog(@"Connection status is now %@", connectionStatusEvent);
}
@end