Skip to content

saturngod/simpleSocketChat

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 

Repository files navigation

TCP chat with iOS using nodejs tcp socket. This is a demo app to show how to connect socket with iOS.

Run server

Before running , you need to change IP address in server/socket.js.

Currently I am using 192.168.1.95 and port 5100. You can change at server/socket.js

node server/socket.js

How to use

Allocate the socket server with HOST and Port

 _chatSocket = [[tcpSocketChat alloc] initWithDelegate:self AndSocketHost:@"192.168.1.49" AndPort:5100];

Send data

[self.chatSocket sendMessage:textField.text];

Receive Data Delegate

-(void)receivedMessage:(NSString *)data
{
	self.logView.text = [self.logView.text stringByAppendingFormat:@"%@",data];
	[self.logView scrollRangeToVisible:NSMakeRange([self.logView.text length], 0)];
}

Disconnect

if([_chatSocket isConnected]) {
	[_chatSocket disconnect];
}

Reconnect

if([_chatSocket isDisconnected])
{
	[_chatSocket reconnect];
}

Socket Server Code From

https://gist.github.com/707146

Usages Library

https://github.com/robbiehanson/CocoaAsyncSocket

Demo

http://www.youtube.com/watch?v=rutDFYw7GFk&feature=youtu.be

About

Node.js TCP socket and iOS SDK

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published