只要把var ws = new WebSocket('ws://....');替换成var ws = new ReconnectingWebSocket('ws://....');