@@ -78,7 +78,8 @@ Here's the API in a nutshell.
7878
7979``` java
8080// Create a new Pusher instance
81- Pusher pusher = new Pusher (YOUR_APP_KEY );
81+ PusherOption options = new PusherOptions (). setCluster(YOUR_APP_CLUSTER );
82+ Pusher pusher = new Pusher (YOUR_APP_KEY , options);
8283
8384pusher. connect(new ConnectionEventListener () {
8485 @Override
@@ -120,32 +121,28 @@ More information in reference format can be found below.
120121The standard constructor take an application key which you can get from the app's API Access section in the Pusher dashboard.
121122
122123``` java
123- Pusher pusher = new Pusher (YOUR_APP_KEY );
124+ PusherOption options = new PusherOptions (). setCluster(YOUR_APP_CLUSTER );
125+ Pusher pusher = new Pusher (YOUR_APP_KEY , options);
124126```
125127
126128If you are going to use [ private] ( http://pusher.com/docs/private_channels ) or [ presence] ( http://pusher.com/docs/presence_channels ) channels then you will need to provide an ` Authorizer ` to be used when authenticating subscriptions. In order to do this you need to pass in a ` PusherOptions ` object which has had an ` Authorizer ` set.
127129
128130``` java
129131HttpAuthorizer authorizer = new HttpAuthorizer (" http://example.com/some_auth_endpoint" );
130- PusherOptions options = new PusherOptions (). setAuthorizer(authorizer);
132+ PusherOptions options = new PusherOptions (). setCluster( YOUR_APP_CLUSTER ) . setAuthorizer(authorizer);
131133Pusher pusher = new Pusher (YOUR_APP_KEY , options);
132134```
133135
134136See the documentation on [ Authenticating Users] ( http://pusher.com/docs/authenticating_users ) for more information.
135137
136- You can also specify the Pusher cluster you wish to connect to on the PusherOptions, e.g.
137-
138- ``` java
139- options. setCluster(" eu" );
140- ```
141-
142138If you need finer control over the endpoint then the setHost, setWsPort and setWssPort methods can be employed.
143139## Connecting
144140
145141In order to send and receive messages you need to connect to Pusher.
146142
147143``` java
148- Pusher pusher = new Pusher (YOUR_APP_KEY );
144+ PusherOption options = new PusherOptions (). setCluster(YOUR_APP_CLUSTER );
145+ Pusher pusher = new Pusher (YOUR_APP_KEY , options);
149146pusher. connect();
150147```
151148
@@ -168,7 +165,8 @@ After disconnection the Pusher instance will release any internally allocated re
168165Implement the ` ConnectionEventListener ` interface to receive connection state change events:
169166
170167``` java
171- Pusher pusher = new Pusher (YOUR_APP_KEY );
168+ PusherOption options = new PusherOptions (). setCluster(YOUR_APP_CLUSTER );
169+ Pusher pusher = new Pusher (YOUR_APP_KEY , options);
172170pusher. connect(new ConnectionEventListener () {
173171 @Override
174172 public void onConnectionStateChange (ConnectionStateChange change ) {
0 commit comments