![Create React App Officially Deprecated Amid React 19 Compatibility Issues](https://cdn.sanity.io/images/cgdhsj6q/production/04fa08cf844d798abc0e1a6391c129363cc7e2ab-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Create React App Officially Deprecated Amid React 19 Compatibility Issues
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
spine-high-templar
Advanced tools
A frontend package which adds websocket and pubSub logic from high-templar to mobx-spine.
The functionality of this package includes:
spine-high-templar offers a Socket model. It is recommended to create this socket in the viewStore and save it in the api instance.
In the store/View
constructor:
this.fetchBootstrap().then(() => {
if (this.bootstrapCode === 200) {
api.socket = new Socket({
url: process.env.CY_FRONTEND_WEBSOCKET_URL,
});
}
});
It is important that the bootstrap has actually succeeded, the high-templar instance will use the headers provided in the socket-open-request to authenticate the user against the binder instance.
The frontend subscribes to a room (in the form of an object). onPublish
will be called with every message published in that room.
Don't forget to unsubscribe when a view will unmount.
View example:
componentDidMount() {
this.subscription = this.props.store.api.socket.subscribe({
onPublish: this.handlePublish.bind(this),
room: {
tenant: 16,
driver: this.props.screenProps.viewStore.currentUser.id,
},
});
}
handlePublish(msg) {
this.props.store.add(msg.data);
}
componentWillUnmount() {
this.props.store.api.socket.unsubscribe(this.subscription);
}
The websocket may disconnect. This can be a client side reason (loss of internet) or a server side reason (deployment). When the websocket has been disconnected, the frontend might be outdated, as publishes may have been missed.
For this reason the subscribe action has a onReconnect callback, where the frontend can refetch/do whatever to make sure it's up to date.
componentDidMount() {
this.subscription = this.props.store.api.socket.subscribe({
onPublish: this.handlePublish.bind(this),
onReconnect: this.handleReconnect.bind(this),
room: {
tenant: 16,
driver: this.props.screenProps.viewStore.currentUser.id,
},
});
}
handlePublish(msg) {
this.props.store.add(msg.data);
}
handleReconnect() {
this.props.store.fetch();
}
componentWillUnmount() {
this.props.store.api.socket.unsubscribe(this.subscription);
}
If the app doesn't use session auth but an Authorization token, one can pass the token under the token
key in the Socket constructor options. Due to a limitation of the WebSocket available in browsers, it's not possible to add custom headers to a websocket open request, so we handle this in high-templar.
The high-templar instance will add a header Authorization: Token ${token}
when authenticating against the binder instance.
api.socket = new Socket({
url: WEBSOCKET_URL,
token: this.authToken.value,
});
FAQs
Websocket addon for MobX-Spine
The npm package spine-high-templar receives a total of 251 weekly downloads. As such, spine-high-templar popularity was classified as not popular.
We found that spine-high-templar demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.