I'm creating a chat application whose WebSocket server is written in java.
For WebSocket client i'm using SocketRocket library.
Everything works fine when i try to connect from
But when i try to connect it using the public IP, it gives following error in
- (void) webSocket:(SRWebSocket *)_webSocket didFailWithError:(NSError *)error method:
Error Domain=NSPOSIXErrorDomain Code=57 "The operation couldn’t be completed. Socket is not connected"
Here is how i initialize the
webSocket = [[SRWebSocket alloc] initWithURL:[NSURL URLWithString:@"ws://IP_ADDRESS:8080/ChatWebSocket/chat/12345"]]; // connects successfully when IP_ADDRESS = localhost or 127.0.0.1 // gives 'Socket is not connected' error when IP_ADDRESS = some public IP address
I've also tried initializing
Therefor i think the issue is at the client end.
Any help will be appreciated.
Thanks in advance