Compress the current state into a message that will be sent to the client
(self, state_diff)
| 484 | return |
| 485 | |
| 486 | def message(self, state_diff): |
| 487 | ''' |
| 488 | Compress the current state into a message that will be sent to the |
| 489 | client |
| 490 | ''' |
| 491 | if self.error == "": |
| 492 | error = "null" |
| 493 | else: |
| 494 | self.docker.destroy() |
| 495 | |
| 496 | if state_diff == "": |
| 497 | state_diff = '""' |
| 498 | if isinstance(state_diff, bytes): |
| 499 | state_diff = state_diff.decode() |
| 500 | |
| 501 | if self.logged_in: |
| 502 | logged_in = "true" |
| 503 | else: |
| 504 | logged_in = "false" |
| 505 | |
| 506 | message = '{{"logged_in":{},"client_id":"{}","error":{},"message":{}}}'.format(logged_in, self.client_id, error, state_diff) |
| 507 | return message |
| 508 | |
| 509 | def player_handler(self): |
| 510 | ''' |
no test coverage detected