Skip to content

Commit 406faf6

Browse files
author
Devendra
committed
merging from master
2 parents 85f23ec + 0f4ea5c commit 406faf6

23 files changed

Lines changed: 312 additions & 222 deletions

File tree

CHANGELOG

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
06-25-13 * NEW VERSION 3.5.3.1 *
2+
. added noleave option to prevent explicit leave requests on page unload.
3+
14
06-25-13 * NEW VERSION 3.5.3 *
25
. fixed the issue with minified version of JS files.
36

README.md

Lines changed: 51 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# YOU MUST HAVE A PUBNUB ACCOUNT TO USE THE API.
22
Create an account at http://www.pubnub.com/account
33

4-
## The PubNub Network JavaScript Real-time SDK v3.5.3
4+
## The PubNub Network JavaScript Real-time SDK v3.5.3.1
55
http://www.pubnub.com - PubNub Real-time Push Service in the Cloud.
66

77
The PubNub Network is a blazingly fast Global Messaging Service for building
@@ -16,7 +16,7 @@ business collaborative solutions, and more.
1616
You may access the latest PubNub JavaScript SDK on The PubNub Network CDN.
1717

1818
```html
19-
<script src=http://cdn.pubnub.com/pubnub-3.5.3.min.js ></script>
19+
<script src=http://cdn.pubnub.com/pubnub-3.5.3.1.min.js ></script>
2020
<script>(function(){
2121
var pubnub = PUBNUB.init({
2222
publish_key : 'demo',
@@ -34,7 +34,7 @@ and for security considerations,
3434
use this following method for initialization:
3535

3636
```html
37-
<script src=http://cdn.pubnub.com/pubnub-3.5.3.min.js ></script>
37+
<script src=http://cdn.pubnub.com/pubnub-3.5.3.1.min.js ></script>
3838
<script>(function(){
3939
4040
var pubnub = PUBNUB.init({ subscribe_key : 'demo' });
@@ -47,7 +47,7 @@ use this following method for initialization:
4747
>**NOTE:** Copy and paste this example into a *blank* HTML file or visit http://jsfiddle.net/geremy/SqamR/ to demo
4848
4949
```html
50-
<script src=http://cdn.pubnub.com/pubnub-3.5.3.min.js ></script>
50+
<script src=http://cdn.pubnub.com/pubnub-3.5.3.1.min.js ></script>
5151
<script>(function(){
5252
5353
// Init
@@ -177,7 +177,7 @@ JavaScript SDK using the **web** build. It's as easy as `copy/paste`.
177177
## ADVANCED SUBSCRIBE CONNECTIVITY OPTIONS/CALLBACKS
178178
```html
179179
<div id=pubnub pub-key=demo sub-key=demo></div>
180-
<script src=http://cdn.pubnub.com/pubnub-3.5.3.min.js ></script>
180+
<script src=http://cdn.pubnub.com/pubnub-3.5.3.1.min.js ></script>
181181
<script>(function(){
182182
PUBNUB.subscribe({
183183
channel : "hello_world", // CONNECT TO THIS CHANNEL.
@@ -201,7 +201,7 @@ when **receiving messages**.
201201

202202
```html
203203
<div id=pubnub pub-key=demo sub-key=demo></div>
204-
<script src=http://cdn.pubnub.com/pubnub-3.5.3.min.js ></script>
204+
<script src=http://cdn.pubnub.com/pubnub-3.5.3.1.min.js ></script>
205205
<script>(function(){
206206
PUBNUB.subscribe({
207207
channel : "hello_world", // CONNECT TO THIS CHANNEL.
@@ -307,8 +307,8 @@ are open source, you’re welcome to see how we did it).
307307
To use AES encryption in PubNub, simply do the following:
308308

309309
```html
310-
<script src=https://pubnub.a.ssl.fastly.net/pubnub-3.5.3.min.js></script>
311-
<script src=https://pubnub.a.ssl.fastly.net/pubnub-crypto-3.5.3.min.js></script>
310+
<script src=https://pubnub.a.ssl.fastly.net/pubnub-3.5.3.1.min.js></script>
311+
<script src=https://pubnub.a.ssl.fastly.net/pubnub-crypto-3.5.3.1.min.js></script>
312312
<script>(function(){
313313
var secure_pubnub = PUBNUB.secure({
314314
publish_key : 'demo',
@@ -375,7 +375,7 @@ http://jsfiddle.net/geremy/8e6Cr/
375375
## SSL MODE
376376
```html
377377
<div id=pubnub ssl=on></div>
378-
<script src=https://pubnub.a.ssl.fastly.net/pubnub-3.5.3.min.js></script>
378+
<script src=https://pubnub.a.ssl.fastly.net/pubnub-3.5.3.1.min.js></script>
379379
<script>(function(){
380380
381381
var pubnub = PUBNUB.init({
@@ -399,7 +399,7 @@ http://jsfiddle.net/geremy/8e6Cr/
399399
## HISTORY
400400
```html
401401
<div id=pubnub></div>
402-
<script src=http://pubnub.a.ssl.fastly.net/pubnub-3.5.3.min.js></script>
402+
<script src=http://pubnub.a.ssl.fastly.net/pubnub-3.5.3.1.min.js></script>
403403
<script>(function(){
404404
405405
var pubnub = PUBNUB.init({
@@ -428,7 +428,7 @@ the timeline as they occured.
428428
429429
```html
430430
<div id=pubnub></div>
431-
<script src=http://pubnub.a.ssl.fastly.net/pubnub-3.5.3.min.js></script>
431+
<script src=http://pubnub.a.ssl.fastly.net/pubnub-3.5.3.1.min.js></script>
432432
<script>(function(){
433433
434434
/* GENERATE CHANNEL */
@@ -465,7 +465,7 @@ and get back an answer with list of users and the occupancy count.
465465

466466
```html
467467
<div id=pubnub pub-key=demo sub-key=demo></div>
468-
<script src=http://cdn.pubnub.com/pubnub-3.5.3.min.js ></script>
468+
<script src=http://cdn.pubnub.com/pubnub-3.5.3.1.min.js ></script>
469469
<script>(function(){
470470
PUBNUB.subscribe({
471471
channel : "hello_world", // CONNECT TO THIS CHANNEL.
@@ -507,7 +507,7 @@ the `pubnub.subscribe` call below.
507507

508508
```html
509509
<div id=pubnub></div>
510-
<script src=http://pubnub.a.ssl.fastly.net/pubnub-3.5.3.min.js></script>
510+
<script src=http://pubnub.a.ssl.fastly.net/pubnub-3.5.3.1.min.js></script>
511511
<script>(function(){
512512
513513
var pubnub = PUBNUB.init({
@@ -557,7 +557,7 @@ The following example opens a `new WebSocket` in
557557

558558
```html
559559
<!-- Import PubNub Core Lib -->
560-
<script src="https://pubnub.a.ssl.fastly.net/pubnub-3.5.3.min.js"></script>
560+
<script src="https://pubnub.a.ssl.fastly.net/pubnub-3.5.3.1.min.js"></script>
561561

562562
<!-- Use WebSocket Constructor for a New Socket Connection -->
563563
<script>(function() {
@@ -605,7 +605,7 @@ The following example opens a `new WebSocket` in
605605

606606
```html
607607
<!-- NON-SSL Import PubNub Core Lib -->
608-
<script src="http://pubnub.a.ssl.fastly.net/pubnub-3.5.3.min.js"></script>
608+
<script src="http://pubnub.a.ssl.fastly.net/pubnub-3.5.3.1.min.js"></script>
609609

610610
<!-- NON-SSL Use WebSocket Constructor for a New Socket Connection -->
611611
<script>(function() {
@@ -622,7 +622,7 @@ How to create a new instance of the PubNub Object directly in JavaScript.
622622
To do this, simply follow this `init` example:
623623

624624
```html
625-
<script src=http://cdn.pubnub.com/pubnub-3.5.3.min.js ></script>
625+
<script src=http://cdn.pubnub.com/pubnub-3.5.3.1.min.js ></script>
626626
<script>(function(){
627627
628628
// INIT PubNub
@@ -650,6 +650,41 @@ To do this, simply follow this `init` example:
650650

651651
>**NOTE:** You do not need to use the `<div id=pubnub>` DIV with this method!
652652
653+
## Disable Explicit Presence Leave Events
654+
655+
Sometimes you are using a lot of Multiplexed channels which when combined
656+
with SSL will cause slowdowns on page changes.
657+
For single page apps, the `noleave` option is not required.
658+
You do not need to use this setting for single page apps.
659+
If you have the following combination of scenarios, then you
660+
will want to use `noleave` option:
661+
662+
1. SSL or JSONP Transports are used.
663+
2. More than `5` Multiplexed Channels.
664+
3. Non-single Page App.
665+
666+
Use the following setup commands to enable `noleave`.
667+
668+
```html
669+
<script src=http://cdn.pubnub.com/pubnub-3.5.3.1.min.js ></script>
670+
<script>(function(){
671+
672+
// INIT PubNub
673+
var pubnub = PUBNUB.init({
674+
noleave : true,
675+
publish_key : 'demo',
676+
subscribe_key : 'demo'
677+
})
678+
679+
// Continue as normal...
680+
681+
})();</script>
682+
```
683+
684+
>**NOTE:** This will have the side affect of faster page unloads
685+
yet no explicit leaves will occur when using presence feature.
686+
687+
653688
## SUPER ADVANCED SETTINGS
654689

655690
#### WINDOWING AND MESSAGE ORDERING

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
3.5.3
1+
3.5.3.1

core/pubnub-common.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,7 @@ function PN_API(setup) {
197197
var SUB_WINDOWING = +setup['windowing'] || DEF_WINDOWING
198198
, SUB_TIMEOUT = (+setup['timeout'] || DEF_SUB_TIMEOUT) * SECOND
199199
, KEEPALIVE = (+setup['keepalive'] || DEF_KEEPALIVE) * SECOND
200+
, NOLEAVE = setup['noleave'] || 0
200201
, PUBLISH_KEY = setup['publish_key'] || ''
201202
, SUBSCRIBE_KEY = setup['subscribe_key'] || ''
202203
, AUTH_KEY = setup['auth_key'] || ''
@@ -255,6 +256,9 @@ function PN_API(setup) {
255256
// Prevent Leaving a Presence Channel
256257
if (channel.indexOf(PRESENCE_SUFFIX) > 0) return;
257258

259+
// No Leave Patch (Prevent Blocking Leave if Desired)
260+
if (NOLEAVE) return;
261+
258262
if (jsonp != '0') data['callback'] = jsonp;
259263

260264
xdr({

modern/pubnub.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Version: 3.5.3
1+
// Version: 3.5.3.1
22
var NOW = 1
33
, READY = false
44
, READY_BUFFER = []
@@ -198,6 +198,7 @@ function PN_API(setup) {
198198
var SUB_WINDOWING = +setup['windowing'] || DEF_WINDOWING
199199
, SUB_TIMEOUT = (+setup['timeout'] || DEF_SUB_TIMEOUT) * SECOND
200200
, KEEPALIVE = (+setup['keepalive'] || DEF_KEEPALIVE) * SECOND
201+
, NOLEAVE = setup['noleave'] || 0
201202
, PUBLISH_KEY = setup['publish_key'] || ''
202203
, SUBSCRIBE_KEY = setup['subscribe_key'] || ''
203204
, AUTH_KEY = setup['auth_key'] || ''
@@ -256,6 +257,9 @@ function PN_API(setup) {
256257
// Prevent Leaving a Presence Channel
257258
if (channel.indexOf(PRESENCE_SUFFIX) > 0) return;
258259

260+
// No Leave Patch (Prevent Blocking Leave if Desired)
261+
if (NOLEAVE) return;
262+
259263
if (jsonp != '0') data['callback'] = jsonp;
260264

261265
xdr({
@@ -922,7 +926,7 @@ THE SOFTWARE.
922926
* UTIL LOCALS
923927
*/
924928
var NOW = 1
925-
, PNSDK = 'PubNub-JS-' + 'Modern' + '/' + '3.5.3'
929+
, PNSDK = 'PubNub-JS-' + 'Modern' + '/' + '3.5.3.1'
926930
, XHRTME = 310000;
927931

928932

0 commit comments

Comments
 (0)