slaveCoder
slaveCoder

Reputation: 537

How to send small messages from one iphone app to other (2 different phones)

I am trying to send a message on button click to another i-phone app. So that based on the message received on the second app it will be able to do some action.

Is there a way to do this?

1.Over internet without any message servers(like using an HTTP-Post).

2.if both the i-phones are connected to same network via wi-fi.

I only need to send a single message on a button click which the second app should be able to pick up and do some action.It is more like when i click a button on phone1->app1 it should trigger an action on phone2->app2

Upvotes: 0

Views: 95

Answers (3)

Jonny
Jonny

Reputation: 16298

There is an app called FireChat that does something similar, without any real need for a message delivering backend for near-vicinity-messaging (like a hundred meter or so I believe), although I believe they might have implemented that too.

https://itunes.apple.com/en/app/firechat/id719829352?mt=8

They use Multipeer Connectivity framework.

Upvotes: 0

Anand Suthar
Anand Suthar

Reputation: 3798

Why you don't use MultiPeer Connectivity.framework as per your need as Apple says

A good tutorial here

Upvotes: 1

Antonio MG
Antonio MG

Reputation: 20410

If they are both in the same WiFi and you know the IP, you can open a socket from one device to the other and send data.

In any other case, you are going to have to use some server based solution like like XMPP, or implement your own server that redirects messages from one device to the other.

Upvotes: 2

Related Questions