Skip to content

Commit

Permalink
Separate fetch logic from websocket logic.
Browse files Browse the repository at this point in the history
  • Loading branch information
felixhageloh committed Nov 5, 2023
1 parent b641b21 commit 9c778a4
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Uebersicht/UBAppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,6 @@ - (void)applicationDidFinishLaunching:(NSNotification *)aNotification

- (NSDictionary*)fetchState
{
[[UBWebSocket sharedSocket] open:[self serverUrl:@"ws"]];
NSURL *urlPath = [[self serverUrl:@"http"] URLByAppendingPathComponent: @"state/"];
NSData *jsonData = [NSData dataWithContentsOfURL:urlPath];
NSError *error = nil;
Expand All @@ -133,6 +132,7 @@ - (void)startUp
void (^handleData)(NSString*) = ^(NSString* output) {
// note that these might be called several times
if ([output rangeOfString:@"server started"].location != NSNotFound) {
[[UBWebSocket sharedSocket] open:[self serverUrl:@"ws"]];
[self->widgetsStore reset: [self fetchState]];
// this will trigger a render
[self->screensController syncScreens:self];
Expand Down

0 comments on commit 9c778a4

Please sign in to comment.