Phonegap:在WiFi上连接两个设备,并使它们彼此通信 [英] Phonegap: Connect two devices on WiFi and get them to communicate with each other

查看:107
本文介绍了Phonegap:在WiFi上连接两个设备,并使它们彼此通信的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我仍然是初学者.因此,我希望您不要问我一些有趣的问题,也许这并不是一个真正的电话问题,但我认为有人会知道我的问题的答案.

I'm still a beginner. so i hope that you will not linch me for asking funny questions Maybe it is not really a phonegap question, but i think someone will know the answer for my question.

我想制作一个可以通过手机(Android或iOS)将数据/内容发送到另一部手机或通过wifi到PC的应用程序(它们位于同一网络上).例如:客户正在选择/订购电话上的物品,完成​​订购后,他会将订单发送给PC/电话上的其他人,以便其他人可以看到客户已订购的东西,然后将其通知发送给他.收到订单,因此客户会看到他的订单已被接受并且正在进行中.

I want to make an app that send data / content from phone (android or ios) to another phone or to pc over wifi (they are on the same network). For example: Customer is choosing / ordering items on a phone and when he is done with ordering he sends order to the other person on pc / phone so the other person can see what the customer has ordered and then sends him back the notification of the received order, so the customer sees that his order is accepted and in progress.

使此功能正常工作的最佳方法是什么,是否有任何库允许此通信或api?电话将数据发送到服务器,然后PC/电话从服务器提取数据会更好吗?

What is the best way to get this thing work, is there any library that allows this communication or api? is it better that phone sends data to server and then pc/phone pulls data from server?

问候,米哈.

推荐答案

两个设备之间的通信需要套接字.

For communication between two devices you need sockets.

我使用此插件 https://www.npmjs. com/package/cordova-plugin-chrome-apps-sockets-tcpserver .

您将在此处找到的API: http://developer.chrome.com/apps/socket .html

The API you will find here: http://developer.chrome.com/apps/socket.html

它工作得很好,但是需要花费一些时间来配置所有内容.

It works very well, but takes some time to configure everything.

这篇关于Phonegap:在WiFi上连接两个设备,并使它们彼此通信的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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