added some handling of closed/closing websockets and alter debug printing.
found out how to make a typed, empty dictionary