Comments (12)
The PubNub Java client for GAE is based on our 3.3 codebase, as 3.4+ uses async, multithreaded requests which are not permitted in GAE.
If you would like to send us an example of what you are trying to do using regular PubNub 3.4 or 3.5, we are happy to assist you in porting it to PubNub for GAE.
geremy
from java.
Thanks for your reply.
My problem is,i created restapi in which when any client open android app the rest will call and that app also send id of that client.
Now i handle restapi so first id subscribe to pubnub and channel name same as client id and now i would like to create another channel for broadcast but i am not able to create using google app engine pubnub jar.
and i would like to set unique uuid for all client that also not possible in GAE.
my code is as follow:
public class PubnubSubscribeServlet extends HttpServlet{
transient private ConfigurationDAO configurationDAO = ConfigurationDAOImpl.getInstance();
@Override
protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
String deviceId = req.getParameter("deviceId");
if(deviceId != null){
Configuration configuration = configurationDAO.fetchConfiguration();
if(configuration != null){
if(configuration.getPublishKey() != null && configuration.getSubscribeKey() != null){
Pubnub pubnub = new Pubnub(configuration.getPublishKey(),configuration.getSubscribeKey(),configuration.getSecretKey());
try {
String channelName = Md5Util.convertMd5(deviceId);
PubNubReceiver receiver = new PubNubReceiver();
pubnub.subscribe(channelName,receiver);
pubnub.subscribe("BROADCAST_CHANNEL",receiver);//NOT WORKING
pubnub.subscribe( new String{'channel1','channel2'}, receiver)//NOT AVAILABLE
} catch (PubnubException e) {
e.printStackTrace();
System.out.println("Error : " + e.getStackTrace());
}
}
}
}
}
Thanks & Regards
Divyesh R. Rupawala
from java.
@DivyeshRupawala Just to be sure I understand you, these are the two main issues for you:
- i would like to create another channel for broadcast but i am not able to create using google app engine pubnub jar.
- I would like to set unique uuid for all client that also not possible in GAE.
-
For # 1, instead of 3 seperate subscribe calls, can you simply issue a pubnub.subscribe( "ch1,ch2,ch3", receiver) (replace ch1,2,3 with your actual channel names). Let me know if that works.
-
You are asking for the ability to set UUID dynamically, correct?
from java.
Thanks for your help.
now pubnub.subscribe( "ch1,ch2,ch3", receiver) is working fine but another problem is why callback not return from connect method?
i check it out Pubnub-Standardedition-3.4.jar it's return from callback only problem with google app engine pubnub jar it's never return from callback and waiting for new message.because of this issue i am not able to subscribe another channel.and after few minutes it will throw an error thread time out.
yes i would like to set UUID dynamically.
Thanks & Regards
Divyesh R. Rupawala
from java.
Hi Divyesh-
You must remain on GAE_33 branch and 3.3 version, as GAE has restrictions such as single-threaded operation that PubNub for Java 3.4+ does not accomodate (PN for Java 3.4+ uses fully async, multi-threaded operations).
So it sounds like the remaining two issues are connect callback and custom UUID? Please prioritize these fixes... 1-5 (1 is urgent, showstopping, 5 is nice-to-have), and we will discuss at next engineering meeting this week.
from java.
Thanks for your help
Yes this two issue connect callback and custom UUID for my project.
and i need it as soon as possible because my client waiting for my response.
Priority : 1
Thanks & Regards
Divyesh R. Rupawala
from java.
Ok, we'll see what we can do... standby for an update by early next week.
geremy
from java.
Hi Divyesh,
We have made a fix for you regarding setting the UUID on this branch:
https://github.com/pubnub/java/tree/GAE_3.3_branch/java/3.3
Please verify.
Also, we've confirmed that the connectCallback also works using this code:
resp.setContentType("text/plain");
resp.getOutputStream().println("hi");
pubnub.setUUID("test-uuid");
try {
pubnub.subscribe("hello_world", new Callback(){
@Override
public boolean successCallback(String channel, Object message) {
// TODO Auto-generated method stub
return false;
}
@Override
public void errorCallback(String channel, Object message) {
// TODO Auto-generated method stub
}
@Override
public void connectCallback(String channel) {
try {
resp.getOutputStream().println("CONNECT");
} catch (IOException e) {
e.printStackTrace();
}
}
@Override
public void reconnectCallback(String channel) {
// TODO Auto-generated method stub
}
@Override
public void disconnectCallback(String channel) {
// TODO Auto-generated method stub
}
});
} catch (PubnubException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
from java.
@DivyeshRupawala Since our GAE code is single-threaded and blocking by design (since GAE does not allow multithreaded code), based on what you are trying to achieve, it may not work... if it still does not work the way you expect, please:
- Send us your code
- Tell us what you are trying to do, and describe how the current PubNub for GAE Client behaves differently than how you would expect it to.
geremy
from java.
Thanks for your your help
My problem is now resolved.Now i am able to set UUID and also create multiple channel using
pubnub.subscribe( "ch1,ch2,ch3", receiver)
Thanks & Regards
Divyesh R. Rupawala
from java.
close #7 fixed
from java.
@DivyeshRupawala great! Let us know what else we can assist with.
from java.
Related Issues (20)
- unsubcription fails HOT 13
- 3.5.6 now available
- GAE integration broken HOT 3
- StrictMode VM Policy violation HOT 1
- Multiple instances HOT 7
- Thread safety HOT 2
- 3.6.0 Released for Java
- allow disabling logs by BuildConfig HOT 1
- https://github.com/pubnub/java/blob/master/android/examples/SubscribeAtBoot/src/com/pubnub/examples/subscribeAtBoot/PubnubService.java#L22 HOT 1
- Never unregister a Receiver HOT 2
- NetworkOnMainThreadException HOT 5
- Message
- I ended up using 3.3 in the GAE_3.3 branch. The issue above refers to the 3.4 code (also in the same branch). HOT 1
- ee
- Cannot access message_type in PNFetchMessageItem HOT 2
- H
- Flagged Crypto.java Security vulnerability HOT 1
- Remove dependecy to jdk.unsupported HOT 6
- Potential CWE-327
- Cryptographic Standard Algorithms Security vulnerability spotted in FileEncryptionUtilKT.kt
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from java.