I have received this from the websocket, but I have no idea what is this for? Why does this happen?
+1 for this question. the only evidence I could found now is that when you are connected to socket, and you turn of the internet connection, it'll trigger viabilityChanged event
Found a little comment in Transport.swift, I think this could explain the usage of this enum

It is forwarded from this update handler in Apple's "Network" framework:
https://developer.apple.com/documentation/network/nwconnection/2998578-viabilityupdatehandler
From the docs:
/// Set a block to be called when the connection's viability changes, which may be called
/// multiple times until the connection is cancelled.
///
/// Connections that are not currently viable do not have a route, and packets will not be
/// sent or received. There is a possibility that the connection will become viable
/// again when network connectivity changes.
final public var viabilityUpdateHandler: ((Bool) -> Void)?
false indicates that it can't send/receive packets, true indicates that it can now send/receive packets. You can do whatever you want with that information! You could attempt to reconnect, show an offline warning to the user, etc.