Using a .NET DLL in Node.js / serverside javascript

后端 未结 8 1334
南旧
南旧 2020-12-02 07:27

I have a pet project that is an online game, the entire game engine is written in C# and I would like to know if there is anyway I can call the functions of this existing as

8条回答
  •  眼角桃花
    2020-12-02 07:59

    I know it's an old question, but wanted to throw in a current answer. With IIS 7.5 and .Net 4.x Websockets are supported, though use of the SignalR library will likely be the path of least resistance. It's similar to the socket.io library for NodeJS.

    As to accessing .Net code via NodeJS, your best options are Edge.js, building a mixed native assembly with C/C++, exposing your .Net code either via a command line application (best to use pipes for input/output) or via a service (TCP or other).

    I find Edge.js to be very limited, and not offer much over a piped console interface.. and feel that a service may be best for a more complex interface. At which point you may be best doing the rest of the project in .Net, unless you have an investment in NodeJS that supersedes said difficulties.

提交回复
热议问题