问题描述
我正在尝试将Revit与服务器nodejs本地主机连接,但是当我从服务器向所有客户端发射数据时,在Revit中什么也没有发生,并且控制台可见的Revit连接和断开了连续性Web服务器nodejs。
服务器本地主机上的代码:
io2.on('connection',function(client){
console.log(client.id+" connected");
client.on("disconnect",function(){
console.log(client.id + " disconnected !");
})
var obj = null;
client.on("send-data",function(data){
console.log(data);
obj = {
method: 'POST',headers: {
'Accept': 'application/json','Content-Type': 'application/json'
},body: JSON.stringify(data)
};
io2.sockets.emit("send-data-from-server",obj);
})
});
app.get("/",function(req,res){
res.render("index");
});
image Revit connected and disconnected continuity web server nodejs here
使用Revit进行代码测试
namespace TF{
[Transaction(TransactionMode.Manual)]
public class ForgeTestCmd : IExternalCommand
{
public Result Execute(ExternalCommandData commandData,ref string message,ElementSet elements)
{
var options = new IO.Options()
{
IgnoreServerCertificateValidation = true,AutoConnect = true,ForceNew = true
};
const string _url = "http://localhost:3000";
Quobject.SocketIoClientDotNet.Client.Socket _socket = IO.Socket(_url,options);
_socket.On(Quobject.SocketIoClientDotNet.Client.Socket.EVENT_CONNECT,() => { });
_socket.On("send-data-from-server",data
=>
{
MessageBox.Show(data.ToString(),"connect");
});
return Result.Succeeded;
}
}
}
我不知道为什么Revit无法监听服务器发出的事件。我也不知道Revit监听服务器的条件。
感谢进阶!
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)