@@ -119,25 +119,9 @@ public void reconnectCallback(String channel, Object message) {
119119 }
120120
121121 @ Override
122- public void successCallback (String channel , Object message , String timetoken ) {
123- //notifyUser("SUBSCRIBE : " + channel + " : "
124- // + message.getClass() + " : " + message.toString());
125- if ( message instanceof JSONObject ) {
126- notifyUser ("SUBSCRIBE : " + channel + " : "
127- + message .getClass () + " : " + message .toString ());
128- try {
129- notifyUser ( "TIMETOKEN: " + timetoken + ", " + ((JSONObject )message ).getString ("data" )) ;
130- notifyUser ( "TIMETOKEN: " + timetoken + ", " + ((JSONObject )message ).getString ("data2" )) ;
131- notifyUser ( "TIMETOKEN: " + timetoken + ", " + ((JSONObject )message ).getString ("data3" )) ;
132- } catch (JSONException e ) {
133- // TODO Auto-generated catch block
134- e .printStackTrace ();
135- }
136-
137- } else {
138- System .out .println ("TIMETOKEN: " + timetoken + ", " + "Message not a json object : " + message );
139- }
140-
122+ public void successCallback (String channel , Object message ) {
123+ notifyUser ("SUBSCRIBE : " + channel + " : "
124+ + message .getClass () + " : " + message .toString ());
141125
142126 }
143127
@@ -273,7 +257,6 @@ public void startDemo() {
273257
274258 pubnub = new Pubnub (this .publish_key , this .subscribe_key , this .secret_key , this .cipher_key , this .SSL );
275259 pubnub .setCacheBusting (false );
276- pubnub .setOrigin ("dara24.devbuild" );
277260 displayMenuOptions ();
278261
279262 String channelName = null ;
@@ -538,45 +521,15 @@ public void reconnectCallback(String channel, Object message) {
538521 }
539522
540523 @ Override
541- public void successCallback (String channel , Object message , String timetoken ) {
542- //notifyUser("SUBSCRIBE : " + channel + " : "
543- // + message.getClass() + " : " + message.toString());
544- if ( message instanceof JSONObject ) {
545- notifyUser ("SUBSCRIBE : " + channel + " : "
546- + message .getClass () + " : " + message .toString ());
547- try {
548- notifyUser ( "TIMETOKEN: " + timetoken + ", " + ((JSONObject )message ).getString ("data" )) ;
549- notifyUser ( "TIMETOKEN: " + timetoken + ", " + ((JSONObject )message ).getString ("data2" )) ;
550- notifyUser ( "TIMETOKEN: " + timetoken + ", " + ((JSONObject )message ).getString ("data3" )) ;
551- } catch (JSONException e ) {
552- // TODO Auto-generated catch block
553- e .printStackTrace ();
554- }
555-
556- } else {
557- System .out .println ("TIMETOKEN: " + timetoken + ", " + "Message not a json object : " + message );
558- }
559-
524+ public void successCallback (String channel , Object message ) {
525+ notifyUser ("SUBSCRIBE : " + channel + " : "
526+ + message .getClass () + " : " + message .toString ());
560527
561528 }
562529
563530 @ Override
564531 public void errorCallback (String channel , PubnubError error ) {
565532
566- /*
567-
568- # Switch on error code, see PubnubError.java
569-
570- if (error.errorCode == 112) {
571- # Bad Auth Key!
572- unsubscribe, get a new auth key, subscribe, etc...
573- } else if (error.errorCode == 113) {
574- # Need to set Auth Key !
575- unsubscribe, set auth, resubscribe
576- }
577-
578- */
579-
580533 notifyUser ("SUBSCRIBE : ERROR on channel " + channel
581534 + " : " + error .toString ());
582535 if (error .errorCode == PubnubError .PNERR_TIMEOUT )
0 commit comments