如何将下面这段代码 利用localStorage存储 改为利用 websocket存储
if (typeof window !== 'undefined' && window.localStorage) {
const storeData = window.localStorage.getItem('store');
if (storeData) applySnapshot(self, JSON.parse(storeData));
reaction(
() => getSnapshot(self),
json => {
window.localStorage.setItem('store', JSON.stringify(json));
}