Closed donald-richardson-dxd closed 2 years ago
Latest commit: b4fbf0c25976dadeb38e3fa62bed20734fd6e189
Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.
Click here to learn what changesets are, and how to add one.
Click here if you're a maintainer who wants to add a changeset to this PR
@donaldr is attempting to deploy a commit to the Stately Team on Vercel.
A member of the Team first needs to authorize it.
This is a PR for the issue that I poorly described in #356 . I have a headless state machine that I'm visualizing by using the xstate inspect server:
import { inspect } from '@xstate/inspect/lib/server';
inspect({
server: new WebSocket.Server({
port: 8888
})
});
I'm using this locally (actually wrapping it in a native webview) and couldn't use https://statecharts.io/inspect?server=localhost:8888
because of mixed content issues. Also, I preferred not to have to rely on an internet connection. This PR change allows me to use xstate-viz locally with the websocket functionality.
This looks good to me - can you add a changeset by running yarn changeset
(this would be a minor change) and run Prettier on the file? Thank you!
I've just landed an older PR that was implementing exactly this: https://github.com/statelyai/xstate-viz/pull/293 . So I'm going to close this one - I'm sorry that you put some effort into it and it didn't land in the end, the PR itself looks OK, it just turned out to be a duplicate.
...when "server" is present in the url parameters.
You can either provide server without a protocol or with. If you don't provide one it's ws by default (like statecharts.io currently does it). If you provide it, as in wss://localhost:8888 it will provide wss as the protocol to createWebSocketReceiver.
Example urls: http://localhost:3000/viz?inspect&server=localhost:8888 http://localhost:3000/viz?inspect&server=ws://localhost:8888 https://localhost:3000/viz?inspect&server=wss://localhost:8888