-
Notifications
You must be signed in to change notification settings - Fork 170
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
CLI: generate a new relay token on the fly if configured is in use
The relay server uses a client-generated token to identify client sessions, and these are exclusive (i.e. only one client can connect using a given token). Any time we run `svix listen` we write the token text to the user's config file to allow _subsequent_ invocations to maintain the same token. This is nice but it also means if you invoke `svix listen` in 2 shells at the same time, the same token is loaded from config, and the 2nd invocation fails -- the server rejects the connection. This diff is a bit hacky, bit essentially when we see this specific control frame from the server, we can generate a new token _on the fly_, never peristing it to config, allowing `listen` to run normally. The newly generated token is given in the welcome message as per usual.
- Loading branch information
1 parent
6a78ca9
commit 40c8d76
Showing
1 changed file
with
125 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters