我正在用 pusher 实现套接字编程。但我不知道在哪里写 ip 地址,以便我可以从服务器获取数据。我正在使用这个例子 https://github.com/pusher/pusher-phonegap-android 你能告诉我我在哪里写 Ip s 我会得到回应。(函数($){
var CONFIG = {
PUSHER: {
APP_KEY: '49e26cb8e9dde3dfc009'
}
};
Pusher.log = function(msg) {
if (window.console && window.console.log) {
window.console.log(msg);
$( '#debug_log' ).prepend( msg );
}
};
document.addEventListener("deviceready", onDeviceReady, false);
function onDeviceReady() {
// Get device info
var deviceInfo = 'Device Name: ' + device.name + '<br />' +
'Device Cordova: ' + device.cordova + '<br />' +
'Device Platform: ' + device.platform + '<br />' +
'Device UUID: ' + device.uuid + '<br />' +
'Device Version: ' + device.version + '<br />';
$('#deviceProperties').html(deviceInfo)
// Connect
var pusher = new Pusher("ws://192.168.1.3:8101/");// i am writting Here my ip but connection problem occur
pusher.connection.bind('state_change', connectionStateChange);
function connectionStateChange(state) {
$('#connectionStatus').html(state.current);
}
// Subscribe
var channel = pusher.subscribe('my-channel');
channel.bind('pusher:subscription_succeeded', subscriptionSucceeded);
function subscriptionSucceeded() {
$('#subscriptionStatus').html('succeeded');
}
channel.bind('my-event', handleMyEvent);
function handleMyEvent(data) {
$('#debug_log').append('<pre>' + JSON.stringify(data, null, 2) + '</pre>');
}
}
})(jQuery);