GCM替代本地网络或将消息发送到设备的IP [英] GCM alternative for local networks or sending messages to device IP

查看:139
本文介绍了GCM替代本地网络或将消息发送到设备的IP的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要通知发送给连接到我的本地网络一些设备。
第一选择是GCM,但是这意味着将消息发送给谷歌服务器,然后谷歌服务器发送消息到设备。
如果当前有什么我的本地网络不提供互联网?

I want to send notifications to some devices connected to my local network. First alternative was GCM but this implies sending a message to Google server and then Google server sends the message to devices. What if currently my local network is not providing internet?

如果有这样的没有这样的选择,是有办法通过TCP包直接发送信息到设备?

If there is no such alternative like this, is there a way to send a message through a TCP package directly to the device?

推荐答案

您应该看一看 MQTT 。还有一个Java库,与Android兼容; Eclipse的泛美卫生组织客户端。在非常简单的术语,MQTT异步发布/订阅机制,非常适合你想要的东西。它运行在TCP / IP之上。你需要在服务器端使用MQTT代理(即mosquitto(mosquitto.org)或RSMB(非常小的消息Broaker)等)

You should take a look at MQTT. There is also a Java library that is compatible with Android; the Eclipse Paho Client. In very simplistic terms, MQTT an asynchronous publish/subscribe mechanism that is well suited for what you want. It runs on top of TCP/IP.. You will need to use a MQTT broker on the server side (i.e. mosquitto (mosquitto.org) or RSMB (Really Small Message Broaker), etc)

如果你有兴趣,我创建了一个简单的项目,可让您连接到树莓派,把你家的灯打开和关闭,并使用Android设备。这里是混帐

If you are interested, I created a simple project that allows you to connect to a Raspberry Pi and turn the lights of your house on and off using and Android device. Here is the git

这篇关于GCM替代本地网络或将消息发送到设备的IP的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆