File tree Expand file tree Collapse file tree
BitStore/Controller/Account/Receive Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -98,6 +98,13 @@ - (void)viewDidLoad {
9898 [self .view addSubview: _amountLabel];
9999}
100100
101+ - (void )viewWillDisappear : (BOOL )animated {
102+ [super viewWillDisappear: animated];
103+ _ws.delegate = nil ;
104+ [_ws close ];
105+ _ws = nil ;
106+ }
107+
101108- (void )actionAdd : (id )sender {
102109 ReceiveAmountViewController* vc = [[ReceiveAmountViewController alloc ] initWithDelegate: self amount: _satoshi];
103110 [self .navigationController pushViewController: vc animated: YES ];
@@ -137,6 +144,14 @@ - (void)webSocketDidOpen:(SRWebSocket *)webSocket {
137144 [webSocket send: cmd];
138145}
139146
147+ - (void )webSocket : (SRWebSocket *)webSocket didFailWithError : (NSError *)error {
148+ NSLog (@" websocked fail: %@ " , error);
149+ }
150+
151+ - (void )webSocket : (SRWebSocket *)webSocket didCloseWithCode : (NSInteger )code reason : (NSString *)reason wasClean : (BOOL )wasClean {
152+ NSLog (@" websocked did close" );
153+ }
154+
140155- (void )webSocket : (SRWebSocket *)webSocket didReceiveMessage : (NSString *)message {
141156 NSDictionary * json = [NSJSONSerialization JSONObjectWithData: [message dataUsingEncoding: NSUTF8StringEncoding] options: 0 error: nil ];
142157 NSArray * outputs = [[json objectForKey: @" x" ] objectForKey: @" out" ];
@@ -155,9 +170,4 @@ - (void)webSocket:(SRWebSocket *)webSocket didReceiveMessage:(NSString *)message
155170 }
156171}
157172
158- - (void )dealloc {
159- [_ws close ];
160- _ws = nil ;
161- }
162-
163173@end
You can’t perform that action at this time.
0 commit comments