There is probably a more elegant way to solve this but right now I have added an isActive field to the client object which denotes whether the client is 'active' yet. A client is declared active once it has requested the local library from the master. Pings (and other changes) should only be pushed to the client once it is active, otherwise there may be race conditions where the master tries to access the client's server API but the client has not yet started its server.
There is probably a more elegant way to solve this but right now I have added an isActive field to the client object which denotes whether the client is 'active' yet. A client is declared active once it has requested the local library from the master. Pings (and other changes) should only be pushed to the client once it is active, otherwise there may be race conditions where the master tries to access the client's server API but the client has not yet started its server.