We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
//MQTTParse中 Write函对ISession参数做了一些处理,但是MQTTClientPacke中调用直接传空,导致发送时异常,请问MQTTClientPacke中如何才能拿到ISession解决此报错呢 public void Write(MQTTMessage msg, Stream stream, ISession session) { IServer server = session.Server; if (server.EnableLog(LogType.Debug)) { server.Log(LogType.Debug, session, $"write mqtt message {msg}"); }
MemoryStream protocolStream = GetProtocolStream(); int num = 0; num |= (int)msg.Type << 4; if (msg.DUP) { num |= 8; } num |= (int)msg.QoS << 1; if (msg.Retain) { num |= 1; } stream.WriteByte((byte)num); msg.Write(protocolStream, session); if (server.EnableLog(LogType.Debug)) { server.Log(LogType.Debug, session, $"write mqtt message body size {protocolStream.Length}"); } mInt7BitHandler.Write(stream, (int)protocolStream.Length); protocolStream.Position = 0L; protocolStream.CopyTo(stream); if (server.EnableLog(LogType.Debug)) { server.Log(LogType.Debug, session, "write mqtt message success"); } } }
MQTTClientPacket中加密部分中: public void Encode(object data, IClient client, Stream stream) { MQTTMessage mQTTMessage = data as MQTTMessage; if (mQTTMessage != null) { mMQTTParse.Write(mQTTMessage, stream.ToPipeStream(), null); return; }
throw new BXException("Invalid message type!"); }
The text was updated successfully, but these errors were encountered:
client是不存在session,你可以在MQTTParse添加一个iclient的参数,服务端传null就好。
Sorry, something went wrong.
No branches or pull requests
//MQTTParse中 Write函对ISession参数做了一些处理,但是MQTTClientPacke中调用直接传空,导致发送时异常,请问MQTTClientPacke中如何才能拿到ISession解决此报错呢
public void Write(MQTTMessage msg, Stream stream, ISession session)
{
IServer server = session.Server;
if (server.EnableLog(LogType.Debug))
{
server.Log(LogType.Debug, session, $"write mqtt message {msg}");
}
MQTTClientPacket中加密部分中:
public void Encode(object data, IClient client, Stream stream)
{
MQTTMessage mQTTMessage = data as MQTTMessage;
if (mQTTMessage != null)
{
mMQTTParse.Write(mQTTMessage, stream.ToPipeStream(), null);
return;
}
The text was updated successfully, but these errors were encountered: