@pusher/chatkit
Advanced tools
Changelog
0.7.3 - 2018-03-20
getAllRooms
from the current user. It only causes confusion. Anyone
using getAllRooms
can replace swap it out for something like the following:// instead of this
currentUser.getAllRooms().then(allRooms => {
doTheThing(allRooms)
})
// do this
currentUser.getJoinableRooms().then(joinable => {
doTheThing(joinable.concat(currentUser.rooms))
})
Changelog
The fetchRequired
property on message attachments is no longer defined
(fetch is never required any more, just use the provided link directly).
The fetchAttachment
method is removed from the current user object since it
is never required.
renames onNewMessage
to onMessage
onPresenceChanged
replaces onUserCameOnline
and onUserWentOffline
.
Takes parameters (state, user)
-- where state
is { current, previous }
and current
and previous
are one of "online"
, "offline"
, or
"unknown"
.
Room memberships (the user property on rooms) are now available only after subscribing to a room. Attempting to access them before subscribing will throw an error.
room IDs are now strings everywhere
Changelog
0.7.0 - 2018-03-13
This version represents a radical departure from 0.6.X. The interface is very different, and there's a good chance we'll miss some of the changes in this log. If something isn't working after migration, the best place to look first is probably the documentation.
onSuccess
, onFailure
callbacks changed to return promises
instead. e.g.chatManager
.connect()
.then(currentUser => {})
.catch(err => {})
All methods take a single object parameter (see the documentation for details on each method's arguments)
Delegates renamed to hooks
throughout. e.g.
currentUser.subscribeToRoom({
roomId,
hooks: {
onNewMessage: m => {},
},
})
Hooks all prefixed with on
. e.g. onNewMessage
, onUserStartedTyping
cursorSet
hook renamed to onNewCursor
authContext.queryParams
and authContext.headers
both moved to the root
options object in the token provider. e.g.
const tokenProvider = new TokenProvider({
url: 'your.auth.url',
queryParams: {
someKey: someValue,
...
},
headers: {
SomeHeader: 'some-value',
...
}
})
addUser
and removeUser
renamed to addUserToRoom
and removeUserFromRoom
methods that used to accept a Room
object now accept a roomId
. e.g.
instead of
currentUser.subscribeToRoom(myRoom, hooks) // WRONG
do
currentUser.subscribeToRoom({ roomId: myRoom.id, hooks })
The behaviour of read cursors has changed: in particular cursors are now
accessed via currentUser.readCursor
and set with
currentUser.setReadCursor
. See the Read Cursors section of the
documentation
for details.
Presence data is now accessable on any user object under user.presence
. e.g.
const isOnline = user.presence.state === "online"
currentUser.users
, and all members of a room are accessable under
room.users
.