Skip to content
This repository was archived by the owner on Dec 21, 2021. It is now read-only.

Commit 5cc2f64

Browse files
committed
update readme, update default url
1 parent fbe3994 commit 5cc2f64

File tree

3 files changed

+19
-17
lines changed

3 files changed

+19
-17
lines changed

README.md

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,9 @@ var sub = client.subscribe(
4141
Option | Default value | Description
4242
------ | ------------- | -----------
4343
url | ws://www.streamr.com/api/v1/ws | Address of the Streamr websocket endpoint to connect to.
44+
authKey | null | Define default authKey to use when none is specified in the call to `client.subscribe`.
4445
autoConnect | true | If set to `true`, the client connects automatically on the first call to `subscribe()`. Otherwise an explicit call to `connect()` is required.
4546
autoDisconnect | true  | If set to `true`, the client automatically disconnects when the last stream is unsubscribed. Otherwise the connection is left open and can be disconnected explicitly by calling `disconnect()`.
46-
authKey | null | Define default authKey to use when none is specified in the call to `client.subscribe`.
4747

4848
### Message handler callback
4949

@@ -54,32 +54,35 @@ Argument | Description
5454
message | A javascript object containing the message itself
5555
metadata | Metadata for the message, for example `metadata.timestamp` etc.
5656

57-
### Resend options
58-
59-
Note that only one of the resend options can be used for a particular subscription. The default functionality is to resend nothing, only subscribe to messages from the subscription moment onwards.
60-
61-
Option | Default value | Description
62-
------ | ------------- | -----------
63-
resend_all | undefined | Set to `true` if you want all the messages for the stream resent from the earliest available message.
64-
resend_last | undefined | Resend the previous `N` messages.
65-
resend_from | undefined | Resend from a specific message number.
66-
resend_from_time | undefined | Resend from a specific Date (or millisecond timestamp).
67-
resend_to | undefined | Can be used in conjunction with `resend_from` to limit the end of the resend. By default it is the newest message.
68-
6957
### Methods
7058

7159
Name | Description
7260
---- | -----------
7361
connect() | Connects to the server, and also subscribes to any streams for which `subscribe()` has been called before calling `connect()`.
7462
disconnect() | Disconnects from the server, clearing all subscriptions.
7563
pause() | Disconnects from the server without clearing subscriptions.
76-
subscribe(streamId, authId, callback, resendOptions) | Subscribes to a stream identified by the string `streamId`. Authentication key `authId` is used. Messages in this stream are passed to the `callback` function. See the above table for `resendOptions`. Returns a `Subscription` object.
64+
subscribe(options, callback) | Subscribes to a stream. Messages in this stream are passed to the `callback` function. See below for subscription options. Returns a `Subscription` object.
7765
unsubscribe(Subscription) | Unsubscribes the given `Subscription`.
7866
unsubscribeAll(`streamId`) | Unsubscribes all `Subscriptions` for `streamId`.
7967
getSubscriptions(`streamId`) | Returns a list of `Subscriptions` for `streamId`.
8068
bind(eventName, function) | Binds a `function` to an event called `eventName`
8169
unbind(eventName, function) | Unbinds the `function` from events called `eventName`
8270

71+
### Subscription options
72+
73+
Note that only one of the resend options can be used for a particular subscription. The default functionality is to resend nothing, only subscribe to messages from the subscription moment onwards.
74+
75+
Name | Description
76+
---- | -----------
77+
stream | Stream id to subscribe to
78+
authKey | User key or stream key that authorizes the subscription. If defined, overrides the client's `authKey`.
79+
partition | Partition number to subscribe to. Defaults to the default partition (0).
80+
resend_all | Set to `true` if you want all the messages for the stream resent from the earliest available message.
81+
resend_last | Resend the previous `N` messages.
82+
resend_from | Resend from a specific message number.
83+
resend_from_time | Resend from a specific Date (or millisecond timestamp).
84+
resend_to | Can be used in conjunction with `resend_from` to limit the end of the resend. By default it is the newest message.
85+
8386
### Binding to events
8487

8588
The client and the subscriptions can fire events as detailed below. You can bind to them using `bind`:

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "streamr-client",
3-
"version": "0.9.0",
3+
"version": "0.9.1",
44
"description": "JS client for subscribing to Streamr streams",
55
"repository": {
66
"type": "git",

streamr-client.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -676,8 +676,7 @@
676676
// Default options
677677
this.options = {
678678
// The server to connect to
679-
url: "wss://data.streamr.com/api/v1/ws",
680-
path: "/api/v1/ws",
679+
url: "wss://www.streamr.com/api/v1/ws",
681680
// Automatically connect on first subscribe
682681
autoConnect: true,
683682
// Automatically disconnect on last unsubscribe

0 commit comments

Comments
 (0)