简体   繁体   English

使用代号为1的WebSockets

[英]Using WebSockets with Codename One

I am new at using Codename One. 我是使用Codename One的新手。 I am trying to deploy a server that will interact with my app on Amazon Web Services using OpsWorks. 我正在尝试部署一个服务器,该服务器将使用OpsWorks在Amazon Web Services上与我的应用程序进行交互。 The server is going to run on Apache Tomcat and be a dynamic web project written in Java, and I am wondering the best way to communicate with the Codename One client. 该服务器将在Apache Tomcat上运行,并且是一个用Java编写的动态Web项目,我想知道与Codename One客户端通信的最佳方法。 I am planning to use the Socket classes provided by Codename One, but and not sure what to use for the server-side code. 我计划使用Codename One提供的Socket类,但不确定服务器端代码使用什么。 Will it work to use WebSockets from Apache? 使用Apache的WebSockets是否可行? I am having difficulty debugging the server code and have hit a wall here. 我在调试服务器代码时遇到困难,在这里遇到了麻烦。 Thanks in advance! 提前致谢!

WebSockets aren't compatible with sockets so you will need to code a websocket implementation which is a bit of work. WebSocket与套接字不兼容,因此您需要编写Websocket实现的代码,这需要一些工作。 I suggest you use HTTP communication which is more portable and very performant on the devices. 我建议您使用HTTP通信,该通信在设备上更可移植且性能非常好。

You can also use solutions such as PubNub which allow for fast message based communications. 您还可以使用诸如PubNub之类的解决方案,以实现基于消息的快速通信。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM