pubnub

PubNub Server does not format message properly

十年热恋 提交于 2019-12-12 14:43:25
问题 I have the server configuration to speak to the Android clients as: <?php require_once("mysql.class.php"); require_once("lib/autoloader.php"); // Setting up the PubNub Server: use Pubnub\Pubnub; $pubnub = new Pubnub( "pub-c...", ## PUBLISH_KEY "sub-c..." ## SUBSCRIBE_KEY ); // Publishing : $post_data = json_encode(array("type"=> "groupMessage", "data" => array("chatUser" => "SERVER", "chatMsg" => "Now lets talk", "chatTime"=>1446514201516))); $info = $pubnub->publish('MainChat', $post_data);

How to retrieve more than 100 messages from the history of a PubNub channel?

不打扰是莪最后的温柔 提交于 2019-12-12 13:14:45
问题 The page about the PubNub History API states that The history() function returns a list of up to 100 messages, the start time token and the ending time token. Is there a way to retrieve more than the 100 messages? I'm currently not a paying customer of PubNub. 回答1: PubNub Load History More than 100 Messages Sometimes you want to slice back in time over a linear stream of data. And often you'll want to do this at different levels of granularity. That is why PubNub Storage and Playback APIs

Access PNMessageResult in PubNub Swift

与世无争的帅哥 提交于 2019-12-12 12:06:13
问题 See this link Based on the following function I am able to receive the response, func client(client: PubNub!, didReceiveMessage message: PNMessageResult!) { println(message) But, I am able to access the data only as message.data which is in the format of PNMessageData. Even that returns the data in following format: { message = "{}"; subscribedChannel = 123; timetoken = 14392105288780634;} How will I access the value of message inside the message.data(PNMessageData) ? 回答1: I have written

How to delete Pubnub channel history when logout from app?

僤鯓⒐⒋嵵緔 提交于 2019-12-12 03:19:10
问题 In my App I'm using PubNub channels to read messages. I get history in two status : .PNReconnectedCategory .PNConnectedCategory I get history like this way: if let lastOpenedDate = NSUserDefaults.standardUserDefaults().objectForKey(PubNubModel.lastHistoryFetchKey) as? NSDate { let endDate = NSNumber(double:lastOpenedDate.timeIntervalSince1970) if UserHistoryChannel != nil { self.client?.historyForChannel(UserHistoryChannel!, start: nil, end: endDate, withCompletion: getHistoryCompletionBlock)

Pubnub for chat in ios

 ̄綄美尐妖づ 提交于 2019-12-12 02:53:27
问题 There is project which have chat feature which is been done by using PubNub. I had gone through the tutorial provided by PubNub and had integrated the pubnub.framework and CocoaLumberjack in my project. And had added the coded as shown in this tutorial My questions are: Do i have to create different channel to chat with the different friends? Or how the channel in the PubNub will work? I want to do only one-one chat. I don't want to implement any group chats. As per my study from using PubNub

GCM Broadcast Receivers

六月ゝ 毕业季﹏ 提交于 2019-12-11 06:39:23
问题 So I've been working with Pubnub and GCM. Although this question is more GCM/Android specific than Pubnub. I've 2 apps - one is my own the other is pubnub's example. Pubnub manifest's receiver tag: <receiver android:name="com.pubnub.pubnubexample.GcmBroadcastReceiver" android:permission="com.google.android.c2dm.permission.SEND" > <intent-filter> <action android:name="com.google.android.c2dm.intent.RECEIVE" /> <category android:name="com.example.gcm" /> </intent-filter> </receiver> My app's

pubnub history; wait for response

末鹿安然 提交于 2019-12-11 06:16:26
问题 I would need some help with pubnub history. I have to retrive last message (object) of the channel in JavaScript. So I do the following: var vrednosti = {}; var debug = 1; getHistory = function(){ pubnub.history({ channel: settings.channel, callback: function(m){ var msg = m[0]; var obj = msg[0]; for (var key in obj){ if (Object.prototype.hasOwnProperty.call(obj, key)){ if(inputs[key].id=='door') inputs[key].checked = vrednosti[key] = obj[key]; else inputs[key].value = vrednosti[key] = obj

PubNub integration with PHP Server and Android Application

亡梦爱人 提交于 2019-12-11 02:25:23
问题 In my project I have to send user's location periodically (E.g. 30Sec) to server using Android application and the PHP server returns nearest users and app displays them on the map. I am looking for a publish subscribe protocol for the real time data transfer. Here is the architecture I was planned. Each mobile app users id will be considered as a topic or channel so that we can send response to each user. PHP server will considered as a topic e.g. "APP_SERVER_TRACKER". All mobile apps

ImportError: cannot import name Pubnub

≡放荡痞女 提交于 2019-12-11 00:49:29
问题 I am trying to control an LED on my Raspberry Pi with the Pubnub platform. I just started and I tried this tutorial: https://www.pubnub.com/blog/2015-05-27-internet-of-things-101-getting-started-w-raspberry-pi/ However, when I want to execute a Python file that imports the Pubnub library with the following line: from pubnub import Pubnub I get this error message: ImportError: cannot import name Pubnub I did everything exactly as told in the tutorial. I even copied the .py classes from their

Cannot unsubscribe with PubNub

你离开我真会死。 提交于 2019-12-11 00:49:14
问题 Im using PubNub, Phonegap, Backbone.js and Require.js to build twiiter-style chat rooms. Currently I'm testing on a desktop with chrome. I have a Chat.js view and in the initialize() function, I subscribe to the channel with: that.pubnub.subscribe({ channel: chatChannel, message: that.handleSingleMessage, }); This works fine and I can see with Chrome inspector that ajax requests are sent off. At the top of the app there is a "back" button. In here I call unsubscribe to unsubscribe the user: