Skip to content

Commit

Permalink
fix: use correct socket.io url in packaged build
Browse files Browse the repository at this point in the history
  • Loading branch information
Julusian committed Oct 10, 2024
1 parent e0d18fe commit b2ea60f
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion apps/app/src/react/api/ApiClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,12 @@ type AddTypeToProperties<T, U> = {
[K in keyof T]: U & T[K]
}

const socket = io('127.0.0.1:5500') // TODO
const socketUri =
window.location.protocol === 'file:' // When served through electron, always connect back to localhost
? 'http://127.0.0.1:5500'
: `${window.location.protocol}//${window.location.hostname}:5500`

const socket = io(socketUri)
export const app = feathers<AddTypeToProperties<ServiceTypes, SocketService>>()
const socketClient = socketio(socket)
app.configure(socketClient)
Expand Down

0 comments on commit b2ea60f

Please sign in to comment.