partykit / partykit

PartyKit simplifies developing multiplayer applications
https://docs.partykit.io/
MIT License
4.68k stars 156 forks source link

Specifying `_pk` in query doesn't override the _pk value generated by PartySocket #159

Closed paulxuca closed 1 year ago

paulxuca commented 1 year ago

Hi there!

Love partykit so far! Noticing the issue mentioned in the title despite the docs saying this is possible: https://github.com/partykit/partykit/blob/main/docs/reference.md

https://github.com/partykit/partykit/blob/main/packages/partysocket/src/index.ts#L51

Thanks in advance!

threepointone commented 1 year ago

Good catch! The documentation is about assigning an id when you use a regular WebSocket to connect to a partykit backend, but you're right that we should let you specify an id in the PartySocket constructor as well. Will fix.

threepointone commented 1 year ago

You can now say new PartySocket({id: 'some-id', ...}) to set the value of _pk in the connection url. Thanks for catching this!