【问题标题】:framework.realtime.co and phonegap for Android适用于 Android 的 framework.realtime.co 和 phonegap
【发布时间】:2014-09-21 14:44:23
【问题描述】:

我正在使用 framework.realtime.co 创建一个网络。它在 web 上运行完美,但是当我将 mi web 编译到带有 phonegap 的应用程序时,该应用程序运行良好,但实时连接无法正常工作。

在网页版上,我有 msj “已连接”,但在带有 phonegap 的编译版上,它什么也没说。

这里是html

    <div id="status">
        Loading...
    </div>

这里是代码js

    loadOrtcFactory(IbtRealTimeSJType, function (factory, error) {

     if (error != null) {
        //////console.log("Factory error: " + error.message);
     } else {                                
        client = factory.createClient();                
        client.setClusterUrl('https://ortc-developers-useast1.realtime.co/server/ssl/2.1');

        client.onConnected = function(c) {
            document.getElementById('status').innerHTML = "connected";
            // send("New hello world");
            c.subscribe('channelAlerta', true, elem_received);
        }

        client.onDisconnected = function() {
            document.getElementById('status').innerHTML = "disconnected";
        }

        client.onReconnecting = function() {
            document.getElementById('status').innerHTML = "reconnected ...";
        }

        client.connect(appkey, token);           
     }
});

【问题讨论】:

  • 具体什么不起作用?
  • 只是实时连接,在网络上连接完美,但在使用 phongap 编译的应用程序上,连接不上。
  • 我添加了 HTML 片段
  • 实时使用cookies吗?
  • 不,我不认为是在使用 cookie。

标签: html cordova frameworks real-time


【解决方案1】:

您需要使用 websocket PhoneGap 插件。检查示例 https://github.com/realtime-framework/Messaging/tree/master/PhoneGap

【讨论】:

    猜你喜欢
    • 2020-01-11
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-09-17
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多