Skip to content

Commit 94d7e53

Browse files
authored
remove hardcoded app name & use wss (#281)
1 parent 0863c0e commit 94d7e53

File tree

5 files changed

+20
-12
lines changed

5 files changed

+20
-12
lines changed
Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,16 @@
1-
const apps = {
2-
'93bb8907-085a-4a0e-83dd-62b0dc98e793': {
3-
name: 'Todos',
4-
},
5-
};
1+
// const apps = {
2+
// '93bb8907-085a-4a0e-83dd-62b0dc98e793': {
3+
// name: 'Todos',
4+
// },
5+
// };
66

77
export const getAppInfoByIds = async (appIds: string[]) => {
88
// sleep for 1 second
9-
await new Promise((resolve) => setTimeout(resolve, 1000));
10-
return apps;
9+
// await new Promise((resolve) => setTimeout(resolve, 1000));
10+
// return apps;
11+
const appInfo: Record<string, { name: string }> = {};
12+
for (const appId of appIds) {
13+
appInfo[appId] = { name: appId };
14+
}
15+
return appInfo;
1116
};

apps/server/src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ app.use(express.json({ limit: '2mb' }));
6969
app.use(cors());
7070

7171
app.get('/', (_req, res) => {
72-
res.send('Server is running (v0.0.8)');
72+
res.send('Server is running (v0.0.9)');
7373
});
7474

7575
app.get('/connect/spaces', async (req, res) => {

packages/hypergraph-react/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@graphprotocol/hypergraph-react",
3-
"version": "0.0.8",
3+
"version": "0.0.9",
44
"description": "React implementation and additional functionality, components, and hooks for the hypergraph SDK framework",
55
"keywords": ["Web3", "Local-First", "Knowledge Graph", "Graph Protocol", "react"],
66
"publishConfig": {

packages/hypergraph-react/src/HypergraphAppContext.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -299,9 +299,12 @@ export function HypergraphAppProvider({
299299

300300
const syncServerUrl = new URL(syncServerUri);
301301
const syncServerWsUrl = new URL(`/?token=${identity.sessionToken}`, syncServerUrl.toString());
302-
syncServerWsUrl.protocol = 'ws:';
303-
const syncServerWsUrlString = syncServerWsUrl.toString();
304302

303+
// Use 'wss:' by default, only use 'ws:' for local development
304+
const isLocalDev = syncServerUrl.hostname === 'localhost' || syncServerUrl.hostname === '127.0.0.1';
305+
syncServerWsUrl.protocol = isLocalDev ? 'ws:' : 'wss:';
306+
307+
const syncServerWsUrlString = syncServerWsUrl.toString();
305308
const websocketConnection = new WebSocket(syncServerWsUrlString);
306309

307310
setWebsocketConnection(websocketConnection);

packages/hypergraph/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@graphprotocol/hypergraph",
3-
"version": "0.0.8",
3+
"version": "0.0.9",
44
"description": "SDK for building performant, type-safe, local-first dapps on top of The Graph ecosystem knowledge graphs.",
55
"publishConfig": {
66
"access": "public",

0 commit comments

Comments
 (0)