Перейти к файлу
Sebastien Phaneuf 6d5d695352
Merge pull request #2 from Unity-Technologies/feature/doc-example
Feature/doc example
2020-03-18 14:17:21 -04:00
.yamato First commit for channel-client-examples 2020-03-10 08:41:23 -04:00
ChannelClientNodeApp~ Cleanup. 2020-03-10 14:57:39 -04:00
Documentation~ First commit for channel-client-examples 2020-03-10 08:41:23 -04:00
Editor Ensure the public api examples are wrapped in between #if 2020-03-18 06:40:36 -04:00
.gitignore First commit for channel-client-examples 2020-03-10 08:41:23 -04:00
.npmignore First commit for channel-client-examples 2020-03-10 08:41:23 -04:00
CHANGELOG.md First commit for channel-client-examples 2020-03-10 08:41:23 -04:00
CHANGELOG.md.meta First commit for channel-client-examples 2020-03-10 08:41:23 -04:00
Editor.meta First commit for channel-client-examples 2020-03-10 08:41:23 -04:00
LICENSE.md First commit for channel-client-examples 2020-03-10 08:41:23 -04:00
LICENSE.md.meta First commit for channel-client-examples 2020-03-10 08:41:23 -04:00
README.md First commit for channel-client-examples 2020-03-10 08:41:23 -04:00
README.md.meta First commit for channel-client-examples 2020-03-10 08:41:23 -04:00
package.json First commit for channel-client-examples 2020-03-10 08:41:23 -04:00
package.json.meta First commit for channel-client-examples 2020-03-10 08:41:23 -04:00

README.md

Channel Client Examples

Code Walkthrough

  • Make a public API for the ChannelService (currently internal). See Editor/ChannelServiceAPI.cs
    • Currently in trunk all ChannelService API are internals.
  • Make an example implementing 2 new routes, one binary and the other using string. See See Editor/ChannelServiceExample.cs
    • This adds a new menu item: Tools/Register Custom Ping Pong Channels that can be use to restart the server and register all listeners.
  • ChannelClientNodeApp~ contains a node application that will connect to Unity on the specified routes and send a bit of data.

How to connect?

  • By default, if you use this package the ChannelService will be started (basically the Websocket server will be listening for connection) automatically and some handlers will be registered each domain reload.
  • The connection address in is : 127.0.0.1:XXXX. Connecting port is dynamic (!). This should be streamlined...
  • To bypass the fact that the port is dynamic, the StartChannelService function of ChannelServiceAPI creates a file <UserAppData>/Local/Unity/Editor/ChannelService.info and writes the address and port in that file.

The Demo

  1. Start Unity
  2. Ensure you add the com.unity.channelservice package.

pm pm pm

  1. See that the console prints these messages:

pm

  1. Install nodejs

  2. Open a command console and be sure to cd to the ChannelClientNodeApp~. Type node index.js.

  3. You should see the following:

pm