diff --git a/CHANGELOG.md b/CHANGELOG.md index 84ca5b2..6e9ad73 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,9 +5,21 @@ The format is based on [keep a changelog](http://keepachangelog.com/) and this p ### Unreleased +### Added +- Added more details comments and documentation on objects and methods. + ### Changed - Changed data structure used to pass session variables to authentication methods. The old structure used was a `Map`. We now use the `Record` for serialization support. +- Changed `StreamData.stream_presence` to `StreamData.sender`. This field should be populated correctly now. +- Changed `MatchData.presences` to a singular `MatchData.presence`. This presence represents the sender. This field should be populated correctly now. +- Match and party data payloads are now serialized as protobuf when using the protobuf adapter. + - Because of this change, `sendMatchState` and `sendPartyData` can now receive bytes as input. If bytes are sent using the default text adapter, they are base64 encoded to a string. + - These functions can no longer receive data payloads of type `any`. Any object previously passed in must be serialized to a string or bytes. This change is enforced at compile time. + - Also due to this change, `MatchData` and `PartyData` have their `data` fields typed as a `Uint8Array`. This breaks + backwards compatibility. Users who send a string as their match or party data will need to use a utility such as `TextDecoder` to deserialize the string. This change is enforced at compile time. +### Fixed +- Fixed an issue with our base64 dependency in React Native. ### [2.3.0] diff --git a/packages/nakama-js-protobuf/package.json b/packages/nakama-js-protobuf/package.json index 84d2053..279ed2b 100644 --- a/packages/nakama-js-protobuf/package.json +++ b/packages/nakama-js-protobuf/package.json @@ -1,6 +1,6 @@ { "name": "@heroiclabs/nakama-js-protobuf", - "version": "1.1.0", + "version": "1.2.0", "description": "Websocket adapter adding protocol buffer support to the Nakama Javascript client.", "main": "dist/nakama-js-protobuf.cjs.js", "module": "dist/nakama-js-protobuf.esm.mjs", diff --git a/packages/nakama-js-test/socket-match.test.ts b/packages/nakama-js-test/socket-match.test.ts index cc16918..dc4a35a 100644 --- a/packages/nakama-js-test/socket-match.test.ts +++ b/packages/nakama-js-test/socket-match.test.ts @@ -188,7 +188,7 @@ describe('Match Tests', () => { }, customid1, customid2, customid3, JSON.stringify(outerPayload), adapter); expect(matchDataString).not.toBeNull(); - expect(JSON.parse(matchDataString).toEqual(outerPayload)); + expect(JSON.parse(matchDataString)).toEqual(outerPayload); }); it.each(adapters)('should join a match, then do not send data to excluded presences', async (adapter) => { diff --git a/packages/nakama-js/package.json b/packages/nakama-js/package.json index 707369d..d4c6eee 100644 --- a/packages/nakama-js/package.json +++ b/packages/nakama-js/package.json @@ -1,6 +1,6 @@ { "name": "@heroiclabs/nakama-js", - "version": "2.3.0", + "version": "2.4.0", "scripts": { "build": "node build.js", "docs": "typedoc index.ts --gaID UA-89839802-1 --out ../../docs"