Giter Club home page Giter Club logo

Comments (12)

geremyCohen avatar geremyCohen commented on August 25, 2024

@DivyeshRupawala

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.

DivyeshRupawala avatar DivyeshRupawala commented on August 25, 2024

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.

geremyCohen avatar geremyCohen commented on August 25, 2024

@DivyeshRupawala Just to be sure I understand you, these are the two main issues for you:

  1. i would like to create another channel for broadcast but i am not able to create using google app engine pubnub jar.
  2. I would like to set unique uuid for all client that also not possible in GAE.
  1. 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.

  2. You are asking for the ability to set UUID dynamically, correct?

from java.

DivyeshRupawala avatar DivyeshRupawala commented on August 25, 2024

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.

geremyCohen avatar geremyCohen commented on August 25, 2024

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.

DivyeshRupawala avatar DivyeshRupawala commented on August 25, 2024

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.

geremyCohen avatar geremyCohen commented on August 25, 2024

Ok, we'll see what we can do... standby for an update by early next week.
geremy

from java.

devendram avatar devendram commented on August 25, 2024

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.

geremyCohen avatar geremyCohen commented on August 25, 2024

@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:

  1. Send us your code
  2. 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.

DivyeshRupawala avatar DivyeshRupawala commented on August 25, 2024

@geremyCohen
@devendram

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.

DivyeshRupawala avatar DivyeshRupawala commented on August 25, 2024

close #7 fixed

from java.

geremyCohen avatar geremyCohen commented on August 25, 2024

@DivyeshRupawala great! Let us know what else we can assist with.

from java.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.