Permalink
Browse files

Add version_request/reply messaging protocol

  • Loading branch information...
1 parent 61e383b commit 7c4fc04a2acef7c7cf0effbb7fdbb2c355220601 @tkf committed Dec 4, 2012
Showing with 17 additions and 0 deletions.
  1. +17 −0 IPython/zmq/ipkernel.py
View
@@ -61,6 +61,12 @@
# Main kernel class
#-----------------------------------------------------------------------------
+# Change this when incrementing the kernel protocol version
+version_major = 1
+version_minor = 1
+version = '{0}.{1}'.format(version_major, version_minor)
+
+
class Kernel(Configurable):
#---------------------------------------------------------------------------
@@ -156,6 +162,7 @@ def __init__(self, **kwargs):
# Build dict of handlers for message types
msg_types = [ 'execute_request', 'complete_request',
'object_info_request', 'history_request',
+ 'version_request',
'connect_request', 'shutdown_request',
'apply_request',
]
@@ -509,6 +516,16 @@ def connect_request(self, stream, ident, parent):
content, parent, ident)
self.log.debug("%s", msg)
+ def version_request(self, stream, ident, parent):
+ vinfo = {
+ 'version': version,
+ 'version_major': version_major,
+ 'version_minor': version_minor,
+ }
+ msg = self.session.send(stream, 'version_reply',
+ vinfo, parent, ident)
+ self.log.debug("%s", msg)
+
def shutdown_request(self, stream, ident, parent):
self.shell.exit_now = True
content = dict(status='ok')

0 comments on commit 7c4fc04

Please sign in to comment.