Skip to content

Commit

Permalink
Online indicator fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
alexwohlbruck committed May 17, 2022
1 parent e0a7e7d commit a2e2eed
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
6 changes: 5 additions & 1 deletion micro/app/uwebsockets/protocol.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,11 @@ class ConnectionClosed(Exception):

def urlparse(uri):
"""Parse ws:https:// URLs"""
match = URL_RE.match(uri)
try:
match = URL_RE.match(uri)
except:
print('Failed to parse URL')
return

if match:
protocol = match.group(1)
Expand Down
2 changes: 1 addition & 1 deletion server/services/lamps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ export const createLamp = async (
color: '#ff0000',
touching: false,
},
deviceData,
deviceData: deviceData,
group: new Types.ObjectId(group._id),
user: new Types.ObjectId(userId),
})
Expand Down
3 changes: 3 additions & 0 deletions server/websockets/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,9 @@ router.ws('/', async (ws: WebSocket, req: express.Request) => {

ws.on('error', (e: any) => {
console.error(e)
if (deviceId) {
setLampOnline(deviceId, false)
}
})

ws.on('close', () => {
Expand Down

0 comments on commit a2e2eed

Please sign in to comment.