This repository has been archived by the owner on Nov 17, 2021. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
815 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// namespace Jupyter.Messages | ||
// { | ||
// using System.Linq; | ||
// using System.Collections.Generic; | ||
// using Newtonsoft.Json; | ||
|
||
// public class CommMessage : Message | ||
// { | ||
// public CommMessage() | ||
// { | ||
// Data = new Dictionary<string, object>(); | ||
// } | ||
|
||
// [JsonProperty("data")] | ||
// public Dictionary<string, object> Data { get; set; } = new Dictionary<string, object>(); | ||
|
||
// [JsonProperty("comm_id")] | ||
// public string CommId { get; set; } = string.Empty; | ||
// } | ||
// } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// namespace Jupyter.Messages | ||
// { | ||
// using System.Linq; | ||
// using System.Collections.Generic; | ||
// using Newtonsoft.Json; | ||
|
||
// public class CommOpenMessage: CommMessage | ||
// { | ||
|
||
// public CommOpenMessage(string name) : base() | ||
// { | ||
// Target = name; | ||
// } | ||
|
||
// [JsonProperty("target_name")] | ||
// public string Target { get; set; } = string.Empty; | ||
// } | ||
// } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
namespace Jupyter.Messages | ||
{ | ||
using System.Linq; | ||
using System.Collections.Generic; | ||
using Newtonsoft.Json; | ||
|
||
public class CommInfoReplyContent : Content | ||
{ | ||
|
||
public CommInfoReplyContent() | ||
{ | ||
Comms = new Dictionary<string, TargetName>(); | ||
} | ||
|
||
public CommInfoReplyContent(Dictionary<string, TargetName> comms) | ||
{ | ||
Comms = comms; | ||
} | ||
|
||
public CommInfoReplyContent(Dictionary<string, string> comms) | ||
{ | ||
Comms = comms.ToDictionary(kvp => kvp.Key, kvp => new TargetName(kvp.Value)); | ||
} | ||
|
||
[JsonProperty("comms")] | ||
public Dictionary<string, TargetName> Comms { get; set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
namespace Jupyter.Messages | ||
{ | ||
using Newtonsoft.Json; | ||
|
||
public class TargetName : Content | ||
{ | ||
public TargetName(string name) | ||
{ | ||
Name = name; | ||
} | ||
|
||
[JsonProperty("target_name")] | ||
public string Name { get; set; } = string.Empty; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
namespace Jupyter.Server.Handlers | ||
{ | ||
using Microsoft.Extensions.Logging; | ||
using Jupyter.Messages; | ||
using NetMQ.Sockets; | ||
using Newtonsoft.Json; | ||
|
||
public class CommInfoHandler : IMessageHandler | ||
{ | ||
private readonly ILogger _logger; | ||
|
||
|
||
public CommInfoHandler(ILogger logger) | ||
{ | ||
_logger = logger; | ||
} | ||
|
||
public void HandleMessage(Message message, RouterSocket serverSocket, PublisherSocket ioPub) | ||
{ | ||
TargetName targetName = message.Content as TargetName; | ||
Message replyMessage = new Message(MessageType.CommInfoReply, CreateCommInfoReply(targetName), message.Header); | ||
|
||
_logger.LogInformation("Sending comm_info_reply"); | ||
serverSocket.SendMessage(replyMessage); | ||
} | ||
|
||
private CommInfoReplyContent CreateCommInfoReply(TargetName name) | ||
{ | ||
CommInfoReplyContent CommInfoReply = new CommInfoReplyContent( new System.Collections.Generic.Dictionary<string, TargetName> { }) | ||
{ | ||
|
||
}; | ||
|
||
return CommInfoReply; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// namespace Jupyter.Server.Handlers | ||
// { | ||
// using Microsoft.Extensions.Logging; | ||
// using Jupyter.Messages; | ||
// using NetMQ.Sockets; | ||
// using Newtonsoft.Json; | ||
|
||
// public class CommOpenHandler : IMessageHandler | ||
// { | ||
// private readonly ILogger _logger; | ||
|
||
|
||
// public CommOpenHandler(ILogger logger) | ||
// { | ||
// _logger = logger; | ||
// } | ||
|
||
// public void HandleMessage(Message message, RouterSocket serverSocket, PublisherSocket ioPub) | ||
// { | ||
// TargetName targetName = message.Content as TargetName; | ||
// Message replyMessage = new Message(MessageType.CommClose, message.Header); | ||
|
||
// _logger.LogInformation("Sending comm_info_reply"); | ||
// serverSocket.SendMessage(replyMessage); | ||
// } | ||
|
||
// } | ||
// } |
Oops, something went wrong.