GWebSocket.h 733 B

123456789101112131415161718192021222324252627282930313233343536
  1. //
  2. // GWebSocket.h
  3. // Pods
  4. //
  5. // Created by gan on 2025/3/24.
  6. //
  7. #ifndef GWebSocket_h
  8. #define GWebSocket_h
  9. #endif /* GWebSocket_h */
  10. #import "config.h"
  11. #import "SocketRocket/SRWebSocket.h"
  12. @protocol GWebSocketDelegate <NSObject>
  13. - (void)onSocketConnectionStateChanged:(SRReadyState)state;
  14. @end
  15. static NSString * _Nullable Friendchat=@"0";
  16. static NSString * _Nullable Groupchat=@"1";
  17. @interface GWebSocket : NSObject
  18. @property (nonatomic,weak) id <GWebSocketDelegate> delegate;
  19. @property (nonatomic, assign, readonly) BOOL isReachable;
  20. + (GWebSocket *_Nonnull)shareInstance;
  21. - (void)connectWebSocket;
  22. - (void)closeWebSocket;
  23. - (void)sendMsg:(NSString *_Nonnull)msg;
  24. -(void)sendRecNote:(NSDictionary *_Nullable)msg;
  25. @end