mirror of
https://github.com/GNS3/gns3-server
synced 2024-12-01 04:38:12 +00:00
Send the server version when a client connects.
This commit is contained in:
parent
7ebd451dda
commit
724e3051fd
@ -22,8 +22,12 @@ JSON-RPC protocol over Websockets.
|
|||||||
import zmq
|
import zmq
|
||||||
import uuid
|
import uuid
|
||||||
import tornado.websocket
|
import tornado.websocket
|
||||||
|
from ..version import __version__
|
||||||
from tornado.escape import json_decode
|
from tornado.escape import json_decode
|
||||||
from ..jsonrpc import JSONRPCParseError, JSONRPCInvalidRequest, JSONRPCMethodNotFound, JSONRPCNotification
|
from ..jsonrpc import JSONRPCParseError
|
||||||
|
from ..jsonrpc import JSONRPCInvalidRequest
|
||||||
|
from ..jsonrpc import JSONRPCMethodNotFound
|
||||||
|
from ..jsonrpc import JSONRPCNotification
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
@ -110,6 +114,8 @@ class JSONRPCWebSocket(tornado.websocket.WebSocketHandler):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
log.info("Websocket client {} connected".format(self.session_id))
|
log.info("Websocket client {} connected".format(self.session_id))
|
||||||
|
# send this server version when a client connects
|
||||||
|
self.write_message({"version": __version__})
|
||||||
self.clients.add(self)
|
self.clients.add(self)
|
||||||
|
|
||||||
def on_message(self, message):
|
def on_message(self, message):
|
||||||
|
@ -42,6 +42,9 @@ def locale_check():
|
|||||||
|
|
||||||
This is to prevent UnicodeEncodeError with unicode paths when using standard library I/O operation
|
This is to prevent UnicodeEncodeError with unicode paths when using standard library I/O operation
|
||||||
methods (e.g. os.stat() or os.path.*) which rely on the system or user locale.
|
methods (e.g. os.stat() or os.path.*) which rely on the system or user locale.
|
||||||
|
|
||||||
|
More information can be found there: http://seasonofcode.com/posts/unicode-i-o-and-locales-in-python.html
|
||||||
|
or there: http://robjwells.com/post/61198832297/get-your-us-ascii-out-of-my-face
|
||||||
"""
|
"""
|
||||||
|
|
||||||
# no need to check on Windows
|
# no need to check on Windows
|
||||||
@ -98,6 +101,8 @@ def main():
|
|||||||
tornado.options.print_help()
|
tornado.options.print_help()
|
||||||
raise SystemExit
|
raise SystemExit
|
||||||
|
|
||||||
|
# check for the correct locale
|
||||||
|
# (UNIX/Linux only)
|
||||||
locale_check()
|
locale_check()
|
||||||
|
|
||||||
from tornado.options import options
|
from tornado.options import options
|
||||||
|
Loading…
Reference in New Issue
Block a user