Adding wss
This commit is contained in:
parent
07273a40bf
commit
797386845a
@ -144,7 +144,12 @@ export default function Page (): JSX.Element {
|
|||||||
savestateFile.arrayBuffer().then((savestateBuffer) => {
|
savestateFile.arrayBuffer().then((savestateBuffer) => {
|
||||||
const romArray = new Uint8Array(romBuffer)
|
const romArray = new Uint8Array(romBuffer)
|
||||||
const savestateArray = new Uint8Array(savestateBuffer)
|
const savestateArray = new Uint8Array(savestateBuffer)
|
||||||
const webSocket = new WebSocket(`ws://${window.location.host}/ws`)
|
const locationProtocol = window.location.protocol
|
||||||
|
if (locationProtocol == null) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
const protocol = locationProtocol.match(/https:/) != null ? 'wss' : 'ws'
|
||||||
|
const webSocket = new WebSocket(`${protocol}://${window.location.host}/ws`)
|
||||||
setWebSocket(webSocket)
|
setWebSocket(webSocket)
|
||||||
webSocket.binaryType = 'arraybuffer'
|
webSocket.binaryType = 'arraybuffer'
|
||||||
webSocket.onclose = (message) => {
|
webSocket.onclose = (message) => {
|
||||||
|
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user