Skip to content

Commit

Permalink
Merge branch 'r2.2.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
pl committed Apr 3, 2014
2 parents a029958 + 23adbe1 commit 5dda353
Show file tree
Hide file tree
Showing 93 changed files with 6,905 additions and 3,267 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
.bundle
*.DS_Store
*.swp
/dist
dist/*
!/dist/*.js
!/dist/*.swf
4 changes: 4 additions & 0 deletions .jshintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
src/base64.js
src/json2.js
src/sockjs/**
src/web-socket-js/**
46 changes: 46 additions & 0 deletions CHANGELOG.markdown
Original file line number Diff line number Diff line change
@@ -1,5 +1,51 @@
# Changelog

## 2.2.0 (2014-04-14)

No changes since 2.2.0-rc3, just changed the version number.

## 2.2.0-rc3 (2014-03-26)

[NEW] Added third argument to the bind method on event emitters to allow binding of context to callbacks

[CHANGED] Changed the primary WebSocket fallback to WSS instead of HTTP

[FIXED] Exception when aborting timers, which caused infinite connection loop on IE8

## 2.2.0-rc2 (2014-02-25)

[NEW] Dependency loader will retry fetching additional resources if they fail to load

[CHANGED] Refactored internals to reduce main file size by over 1KB

[CHANGED] Improved heartbeat handling for HTTP transports

[CHANGED] Removed wssHost and httpsHost options, reverted to a single domain regardless of encryption

[CHANGED] Added extra 1s to the cached transport timeout

[CHANGED] Updated the stats protocol

[FIXED] MozWebSocket is not assigned to WebSocket anymore

[FIXED] Socket listeners are always unbound after closing the connection

## 2.2.0-rc1 (2014-01-14)

[NEW] XHR streaming and polling transports were extracted from SockJS

[NEW] Reduced the number of roundtrips required by HTTP streaming and polling transports for connecting from 3 to 1

[NEW] Refactored the connection strategy to be faster and more reliable for clients using HTTP

[NEW] Added new options - `wssHost` and `httpsHost` for encrypted connections

[NEW] HTTP streaming and polling are now supported on Opera

[CHANGED] Reduced the size of sockjs.js

[FIXED] Issue with SockJS streaming not being able to reconnect

## 2.1.6 (2014-01-09)

[NEW] Ping on offline events to detect disconnections quicker
Expand Down
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ source "http://rubygems.org"
group :development do
# uploader
gem 'rake'
gem 'jbundle', :git => "git@github.com:mloughran/jbundle.git"
gem 'jbundle', :github => 'mloughran/jbundle'
gem 'aws-s3', '~> 0.6.0'
gem 'httparty'
# testing
Expand Down
4 changes: 2 additions & 2 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
GIT
remote: git@github.com:mloughran/jbundle.git
remote: git://github.com/mloughran/jbundle.git
revision: 09bfca3ca8dd81872619eab9da6ad125de6d323f
specs:
jbundle (0.1.3)
Expand All @@ -19,7 +19,7 @@ GEM
timers (~> 1.1.0)
childprocess (0.3.9)
ffi (~> 1.0, >= 1.0.11)
closure-compiler (1.1.3)
closure-compiler (1.1.10)
coderay (1.1.0)
crack (0.1.8)
diff-lcs (1.2.5)
Expand Down
36 changes: 28 additions & 8 deletions JFile
Original file line number Diff line number Diff line change
Expand Up @@ -7,26 +7,28 @@ target_dir './dist'

src_dir './src'

version '2.1.6'
version '2.2.0'

bundle 'pusher.js' do
license 'pusher-licence.js'
file 'pusher.js'

file 'utils/timer.js'
file 'utils/periodic_timer.js'
file 'utils/timers.js'

file 'util.js'
file 'defaults.js'
file 'config.js'
file 'errors.js'
file 'events_dispatcher.js'

file 'dom/script_receiver_factory.js'
file 'dom/script_request.js'

file 'dependency_loader.js'
file 'dependencies.js'

file 'base64.js'
file 'jsonp/jsonp_request.js'
file 'jsonp/jsonp_receiver.js'

file 'timeline/timeline.js'
file 'timeline/timeline_sender.js'
Expand All @@ -39,10 +41,10 @@ bundle 'pusher.js' do
file 'strategies/sequential_strategy.js'
file 'strategies/transport_strategy.js'

file 'transports/abstract_transport.js'
file 'transports/flash_transport.js'
file 'transports/sockjs_transport.js'
file 'transports/ws_transport.js'
file 'transports/url_schemes.js'
file 'transports/transport_connection.js'
file 'transports/transport.js'
file 'transports/transports.js'

file 'transports/assistant_to_the_transport_manager.js'
file 'transports/transport_manager.js'
Expand Down Expand Up @@ -76,6 +78,24 @@ bundle 'sockjs.js' do
file 'sockjs/sockjs.js'
end

bundle 'xhr.js' do
license 'pusher-licence.js'
file 'http/http_request.js'
file 'http/http_xhr_request.js'
file 'http/http_socket.js'
file 'http/http_streaming_socket.js'
file 'http/http_polling_socket.js'
end

bundle 'xdr.js' do
license 'pusher-licence.js'
file 'http/http_request.js'
file 'http/http_xdomain_request.js'
file 'http/http_socket.js'
file 'http/http_streaming_socket.js'
file 'http/http_polling_socket.js'
end

file 'json2.js'

# Just copy this file across
Expand Down
43 changes: 38 additions & 5 deletions README.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ You can attach behaviour to these events regardless of the channel the event is

### Per-channel events

These are bound to a specific channel, and mean that you can reuse event names in different parts of you client application. The following might be an example of a stock tracking app where several channels are opened for different companies:
These are bound to a specific channel, and mean that you can reuse event names in different parts of your client application. The following might be an example of a stock tracking app where several channels are opened for different companies:

var socket = new Pusher('MY_API_KEY');
var channel = socket.subscribe('APPL');
Expand All @@ -178,6 +178,27 @@ These are bound to a specific channel, and mean that you can reuse event names i
}
);

### Bind event handler with optional context

It is possible to provide a third, optional parameter that is used as the `this` value when calling a handler:

var context = { title: 'Pusher' };
var handler = function(){
console.log('My name is ' + this.title);
};
channel.bind('new-comment', handler, context);

### Unbind event handlers

Remove previously-bound handlers from an object. Only handlers that match all of the provided arguments (`eventName`, `handler` or `context`) are removed:

channel.unbind('new-comment', handler); // removes just `handler` for the `new-comment` event
channel.unbind('new-comment'); // removes all handlers for the `new-comment` event
channel.unbind(null, handler); // removes `handler` for all events
channel.unbind(null, null, context); // removes all handlers for `context`
channel.unbind(); // removes all handlers on `channel`


### Binding to everything

It is possible to bind to all events at either the global or channel level by using the method `bind_all`. This is used for debugging, but may have other utilities.
Expand Down Expand Up @@ -218,6 +239,12 @@ Then after loading `pusher.js`, but before connecting, you need to overwrite the
suffix: Pusher.dependency_suffix
});

## SockJS compatibility

Most browsers have a limit of 6 simultaneous connections to a single domain, but Internet Explorer 6 and 7 have a limit of just 2. This means that you can only use a single Pusher connection in these browsers, because SockJS requires an HTTP connection for incoming data and another one for sending. Opening the second connection will break the first one as the client won't be able to respond to ping messages and get disconnected eventually.

All other browsers work fine with two or three connections.

## Developing

Use Bundler to install all development dependencies
Expand All @@ -238,6 +265,16 @@ In order to build the minified versions:

If you wish to host the javascript on your own server you need to change [:js][:host] in `config.yml` and then rebuild.

## How to install Flash SDK

Download [Flex 4 SDK](http://sourceforge.net/adobe/flexsdk/wiki/Download%20Flex%204/ - if it returns an swf file, open it in the browser and you'll be greeted by the downloader).

Unzip the SDK and move it somewhere (e.g. `/usr/local/flex`, so that executables are in `/usr/local/flex/bin`) and add it to the path:

export PATH=/usr/local/flex/bin:$PATH

Now scripts should be able to pick up all the tools needed to build Flash files.

## Building

`./JFile` declares all bundles, src dir and target dir. See [/~https://github.com/ismasan/jbundle](/~https://github.com/ismasan/jbundle)
Expand Down Expand Up @@ -317,7 +354,3 @@ Then start the server, run one of following commands:
bin/karma # runs both unit and integration tests

All configured browsers will be automatically opened and will run all tests. Testacular also re-executes all specs on file changes. After you close the server, browsers will get shut down too.

### Old framework

There are still some tests in the old framework, though they will be removed in the future. Open `test/sane/index.html` and click run to execute the suite.
13 changes: 12 additions & 1 deletion config/config.yml.example
Original file line number Diff line number Diff line change
@@ -1,10 +1,21 @@
:development:
:js:
:host: foo
:cdn:
:cdn:
:http: http://localhost:5555/
:https: http://localhost:5555/

:staging:
:js:
:cdn:
:http: http://js.staging.pusher.com/
:https: https://d14dz7d59i920.cloudfront.net/
:s3:
:cf_distribution_id: <YOUR AWS CLOUD FRONT DISTRIBUTION ID>
:bucket: com.pusher.staging.js
:access_key_id:
:secret_access_key:

:production:
:js:
:cdn:
Expand Down
2 changes: 1 addition & 1 deletion dist/flashfallback.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* Pusher JavaScript Library v2.1.6
* Pusher JavaScript Library v2.2.0
* http://pusherapp.com/
*
* Copyright 2011, Pusher
Expand Down
Loading

0 comments on commit 5dda353

Please sign in to comment.