├── .gitignore
├── License
├── README.md
├── Realtime.DroidBridge
├── .idea
│ ├── .name
│ ├── Realtime.DroidBridge.iml
│ ├── artifacts
│ │ └── Realtime_DroidBridge_jar.xml
│ ├── codeStyleSettings.xml
│ ├── compiler.xml
│ ├── copyright
│ │ └── profiles_settings.xml
│ ├── encodings.xml
│ ├── libraries
│ │ └── androidasync_2_1_6.xml
│ ├── misc.xml
│ ├── modules.xml
│ ├── vcs.xml
│ └── workspace.xml
├── AndroidManifest.xml
├── META-INF
│ └── MANIFEST.MF
├── default.properties
├── jni
│ ├── Android.mk
│ ├── Application.mk
│ ├── Build.bat
│ ├── Build.txt
│ ├── BuildInternal.bat
│ ├── Clean.bat
│ ├── RealtimeDroid.cpp
│ └── RealtimeDroid.h
├── libs
│ ├── androidasync-2.1.6.jar
│ ├── armeabi-v7a
│ │ └── libRealtimeDroid.so
│ ├── armeabi
│ │ └── libRealtimeDroid.so
│ └── x86
│ │ └── libRealtimeDroid.so
├── out
│ └── artifacts
│ │ └── Realtime_DroidBridge_jar
│ │ └── Realtime.DroidBridge.jar
├── res
│ └── values
│ │ └── strings.xml
└── src
│ └── realtime
│ └── droidbridge
│ └── BridgeClient.java
├── Realtime.Ortc.Api
├── Api
│ ├── AuthenticationClient.cs
│ ├── BalancerClient.cs
│ ├── BufferedMessage.cs
│ ├── ChannelPermission.cs
│ ├── ChannelSubscription.cs
│ ├── ClusterClient.cs
│ ├── OrtcException.cs
│ ├── Presence.cs
│ ├── PresenceClient.cs
│ ├── RealtimeProxy.cs
│ ├── StringExtensions.cs
│ ├── Strings.cs
│ └── TaskTimer.cs
├── IOrtcClient.cs
├── OrtcFactory.cs
├── Properties
│ └── AssemblyInfo.cs
├── Realtime..Ortc.Api.sln
└── Realtime.Ortc.Api.csproj
├── Realtime.Unity
├── Assembly-CSharp-Editor-vs.csproj
├── Assembly-CSharp-Editor.csproj
├── Assembly-CSharp-vs.csproj
├── Assembly-CSharp.csproj
├── Assets
│ ├── Realtime.meta
│ ├── Realtime
│ │ ├── Demos.meta
│ │ ├── Demos
│ │ │ ├── LobbyTest.cs
│ │ │ ├── LobbyTest.cs.meta
│ │ │ ├── LobbyTest.unity
│ │ │ ├── LobbyTest.unity.meta
│ │ │ ├── OrtcExampleScene.cs
│ │ │ ├── OrtcExampleScene.cs.meta
│ │ │ ├── OrtcExampleScene.unity
│ │ │ ├── OrtcExampleScene.unity.meta
│ │ │ ├── _Terminal.meta
│ │ │ └── _Terminal
│ │ │ │ ├── Internal.meta
│ │ │ │ ├── Internal
│ │ │ │ ├── ClearCommand.cs
│ │ │ │ ├── ClearCommand.cs.meta
│ │ │ │ ├── ObservableList.cs
│ │ │ │ ├── ObservableList.cs.meta
│ │ │ │ ├── SpamCommand.cs
│ │ │ │ ├── SpamCommand.cs.meta
│ │ │ │ ├── TerminalCommandView.cs
│ │ │ │ ├── TerminalCommandView.cs.meta
│ │ │ │ ├── TerminalItemView.cs
│ │ │ │ ├── TerminalItemView.cs.meta
│ │ │ │ ├── TerminalView.cs
│ │ │ │ └── TerminalView.cs.meta
│ │ │ │ ├── Terminal.cs
│ │ │ │ ├── Terminal.cs.meta
│ │ │ │ ├── Terminal.prefab
│ │ │ │ ├── Terminal.prefab.meta
│ │ │ │ ├── TerminalExample.unity
│ │ │ │ ├── TerminalExample.unity.meta
│ │ │ │ ├── TerminalModels.cs
│ │ │ │ └── TerminalModels.cs.meta
│ │ ├── Lobby.meta
│ │ ├── Lobby
│ │ │ ├── LobbyMessenger.cs
│ │ │ ├── LobbyMessenger.cs.meta
│ │ │ ├── LobbyModels.cs
│ │ │ ├── LobbyModels.cs.meta
│ │ │ ├── LobbyService.cs
│ │ │ └── LobbyService.cs.meta
│ │ ├── Ortc.meta
│ │ ├── Ortc
│ │ │ ├── Editor.meta
│ │ │ ├── Editor
│ │ │ │ ├── OrtcIOSPostProcessor.cs
│ │ │ │ └── OrtcIOSPostProcessor.cs.meta
│ │ │ ├── Internal.meta
│ │ │ ├── Internal
│ │ │ │ ├── DotNetConnection.cs
│ │ │ │ ├── DotNetConnection.cs.meta
│ │ │ │ ├── DroidConnection.cs
│ │ │ │ ├── DroidConnection.cs.meta
│ │ │ │ ├── HttpUtility.cs
│ │ │ │ ├── HttpUtility.cs.meta
│ │ │ │ ├── IOSConnection.cs
│ │ │ │ ├── IOSConnection.cs.meta
│ │ │ │ ├── IWebSocketConnection.cs
│ │ │ │ ├── IWebSocketConnection.cs.meta
│ │ │ │ ├── MonoPInvokeCallbackAttribute.cs
│ │ │ │ ├── MonoPInvokeCallbackAttribute.cs.meta
│ │ │ │ ├── RealtimeDictionary.cs
│ │ │ │ ├── RealtimeDictionary.cs.meta
│ │ │ │ ├── WSAConnection.cs
│ │ │ │ ├── WSAConnection.cs.meta
│ │ │ │ ├── WebGLBridge.cs
│ │ │ │ ├── WebGLBridge.cs.meta
│ │ │ │ ├── WebGLConnection.cs
│ │ │ │ └── WebGLConnection.cs.meta
│ │ │ ├── UnityOrtcClient.cs
│ │ │ ├── UnityOrtcClient.cs.meta
│ │ │ ├── UnityOrtcStartup.cs
│ │ │ └── UnityOrtcStartup.cs.meta
│ │ ├── Plugins.meta
│ │ ├── Plugins
│ │ │ ├── IOS.meta
│ │ │ ├── IOS
│ │ │ │ ├── IOSBridge.h
│ │ │ │ ├── IOSBridge.h.meta
│ │ │ │ ├── IOSBridge.m
│ │ │ │ ├── IOSBridge.m.meta
│ │ │ │ ├── SocketRocket.meta
│ │ │ │ └── SocketRocket
│ │ │ │ │ ├── SRWebSocket.h
│ │ │ │ │ ├── SRWebSocket.h.meta
│ │ │ │ │ ├── SRWebSocket.m
│ │ │ │ │ ├── SRWebSocket.m.meta
│ │ │ │ │ └── SocketRocket-Prefix.pch.meta
│ │ │ ├── Realtime.DroidBridge.jar
│ │ │ ├── Realtime.DroidBridge.jar.meta
│ │ │ ├── Realtime.Ortc.Api.dll
│ │ │ ├── Realtime.Ortc.Api.dll.meta
│ │ │ ├── armeabi-v7a.meta
│ │ │ ├── armeabi-v7a
│ │ │ │ ├── libRealtimeDroid.so
│ │ │ │ └── libRealtimeDroid.so.meta
│ │ │ ├── libRealtimeWebGL.jslib
│ │ │ ├── libRealtimeWebGL.jslib.meta
│ │ │ ├── websocket-sharp.dll
│ │ │ ├── websocket-sharp.dll.meta
│ │ │ ├── x86.meta
│ │ │ └── x86
│ │ │ │ ├── libRealtimeDroid.so
│ │ │ │ └── libRealtimeDroid.so.meta
│ │ ├── README.txt
│ │ ├── README.txt.meta
│ │ ├── Resources.meta
│ │ └── Resources
│ │ │ ├── README.txt
│ │ │ ├── README.txt.meta
│ │ │ ├── Realtime.png
│ │ │ └── Realtime.png.meta
│ ├── WSATestCertificate.pfx
│ └── WSATestCertificate.pfx.meta
├── Realtime.Unity-csharp.sln
├── Realtime.Unity.CSharp.Editor.csproj
├── Realtime.Unity.CSharp.csproj
├── Realtime.Unity.sln
├── UnityVS.Realtime.Unity.CSharp.Editor.csproj
├── UnityVS.Realtime.Unity.CSharp.csproj
├── UnityVS.Realtime.Unity.sln
└── dfsdfsdf.apk
├── RealtimeForUnity.unitypackage
└── libs
└── UnityEngine.dll
/.gitignore:
--------------------------------------------------------------------------------
1 | [Ll]ibrary/
2 | [Tt]emp/
3 | [Oo]bj/
4 | [Bb]uilds/
5 | bin/
6 | obj/
7 | out/production/
8 | out/artifacts/
9 | gen/
10 | ProjectSettings/
11 |
12 | UnityVS/
13 | UnityVS.meta
14 |
15 |
16 | # Autogenerated VS/MD solution and project files
17 | *.userprefs
18 |
19 |
20 | #Fast Platform Switch
21 | /LocalCache/
--------------------------------------------------------------------------------
/License:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2016 Nicholas Ventimiglia
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Realtime Unity3d
2 |
3 | The Realtime Framework Messaging Service is a highly-scalable pub/sub message broker. Using your favorite programming language you'll be able to broadcast messages to millions of users, reliably and securely. It's all in the cloud so you don't need to manage servers.
4 |
5 | ## WHY REALTIME FRAMEWORK ?
6 |
7 | **It's cloud-hosted**
8 | You just use the API and we take care of all the infrastructure to make it work around the world.
9 |
10 | **It's auto-scalable**
11 | You can scale from one user to millions, we'll adapt automatically to your application needs.
12 |
13 | **It's secure**
14 | A token-based security layer allows you to assign permissions to what your users can do.
15 |
16 | **It's time saving**
17 | Ready-to-use components will reduce your development time so you'll deploy sooner.
18 |
19 | **It's future proof**
20 | We'll help you adapt to future web protocols changes so you don't have to rewrite your code.
21 |
22 | **It's cost effective**
23 | You'll pay as you go. We'll just charge you for what you use. From prototype to production.
24 |
25 |
26 | ## Continue
27 |
28 | [**Realtime Account**](https://accounts.realtime.co/login/)
29 |
30 | [**Realtime Documentation**](http://messaging-public.realtime.co/documentation/starting-guide/overview.html)
31 |
32 | [**Unity3d Plugin**](https://github.com/NVentimiglia/Realtime-Unity3d/raw/master/RealtimeForUnity.unitypackage)
33 |
34 | [**Unity3d Documentation**](https://github.com/NVentimiglia/Realtime-Unity3d/wiki)
35 |
36 | [**Unity3d Storage**](http://framework.realtime.co/storage/#unity)
37 |
38 | [**Other Platforms**](http://framework.realtime.co)
39 |
40 | [**Network Status**](http://status.realtime.co/)
41 |
42 |
43 |
44 |
45 |
--------------------------------------------------------------------------------
/Realtime.DroidBridge/.idea/.name:
--------------------------------------------------------------------------------
1 | Realtime.DroidBridge
--------------------------------------------------------------------------------
/Realtime.DroidBridge/.idea/Realtime.DroidBridge.iml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/Realtime.DroidBridge/.idea/artifacts/Realtime_DroidBridge_jar.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | $PROJECT_DIR$/out/artifacts/Realtime_DroidBridge_jar
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/Realtime.DroidBridge/.idea/compiler.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/Realtime.DroidBridge/.idea/copyright/profiles_settings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/Realtime.DroidBridge/.idea/encodings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Realtime.DroidBridge/.idea/libraries/androidasync_2_1_6.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/Realtime.DroidBridge/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
19 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
--------------------------------------------------------------------------------
/Realtime.DroidBridge/.idea/modules.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/Realtime.DroidBridge/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Realtime.DroidBridge/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/Realtime.DroidBridge/META-INF/MANIFEST.MF:
--------------------------------------------------------------------------------
1 | Manifest-Version: 1.0
2 |
3 |
--------------------------------------------------------------------------------
/Realtime.DroidBridge/default.properties:
--------------------------------------------------------------------------------
1 | # This file is automatically generated by Android Tools.
2 | # Do not modify this file -- YOUR CHANGES WILL BE ERASED!
3 | #
4 | # This file must be checked in Version Control Systems.
5 | #
6 | # To customize properties used by the Ant build system use,
7 | # "build.properties", and override values to adapt the script to your
8 | # project structure.
9 |
10 | # Project target.
11 | target=android-3
12 |
--------------------------------------------------------------------------------
/Realtime.DroidBridge/jni/Android.mk:
--------------------------------------------------------------------------------
1 | # Copyright (C) 2009 The Android Open Source Project
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 | #
15 |
16 | LOCAL_PATH := $(call my-dir)
17 |
18 | include $(CLEAR_VARS)
19 |
20 | LOCAL_MODULE := RealtimeDroid
21 | LOCAL_SRC_FILES := RealtimeDroid.cpp
22 |
23 | LOCAL_LDLIBS := -L$(SYSROOT)/usr/lib -llog
24 | LOCAL_SHARED_LIBRARIES := libcutils
25 |
26 | include $(BUILD_SHARED_LIBRARY)
27 |
28 |
--------------------------------------------------------------------------------
/Realtime.DroidBridge/jni/Application.mk:
--------------------------------------------------------------------------------
1 | APP_ABI := armeabi armeabi-v7a x86
2 | APP_STL := stlport_static
3 | STLPORT_FORCE_REBUILD := true
4 |
5 | #APP_ABI := all
6 |
7 |
--------------------------------------------------------------------------------
/Realtime.DroidBridge/jni/Build.bat:
--------------------------------------------------------------------------------
1 | cmd.exe /k BuildInternal.bat
--------------------------------------------------------------------------------
/Realtime.DroidBridge/jni/Build.txt:
--------------------------------------------------------------------------------
1 | http://developer.android.com/ndk/guides/ndk-build.html#ifc
2 |
3 | 1) Open CMD
4 | 2) Navigate to project jni folder
5 | 3) run ndk-build
6 |
7 |
8 | cd E:\Projects\Realtime\Realtime.Unity3d\v3\Realtime.DroidBridge\jni
9 | E:\
10 | D:\Android\sdk\ndk-bundle\ndk-build clean
11 | D:\Android\sdk\ndk-bundle\ndk-build
12 |
13 |
14 |
--------------------------------------------------------------------------------
/Realtime.DroidBridge/jni/BuildInternal.bat:
--------------------------------------------------------------------------------
1 | cd E:\Projects\Realtime\Realtime.Unity3d\v3\Realtime.DroidBridge\jni
2 | E:\
3 | D:\Android\sdk\ndk-bundle\ndk-build
4 | Pause
--------------------------------------------------------------------------------
/Realtime.DroidBridge/jni/Clean.bat:
--------------------------------------------------------------------------------
1 | cd E:\Projects\Realtime\Realtime.Unity3d\v3\Realtime.DroidBridge\jni
2 | E:\
3 | D:\Android\sdk\ndk-bundle\ndk-build clean
4 | Pause
--------------------------------------------------------------------------------
/Realtime.DroidBridge/jni/RealtimeDroid.cpp:
--------------------------------------------------------------------------------
1 | #include "RealtimeDroid.h"
2 | #include
3 | #include
4 | #include
5 |
6 | extern "C" {
7 |
8 | void logd(const char*);
9 |
10 | JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM *jvm, void *reserved){
11 | return JNI_VERSION_1_6;
12 | }
13 |
14 | void logd(const char* msg)
15 | {
16 | __android_log_print(ANDROID_LOG_DEBUG, "RealtimeDroid", "%s", msg);
17 | }
18 |
19 | // C# Subscribe method handlers
20 |
21 | void RegisterOpenedDelegate(NativeOpenedDelegate callback) {
22 | onOpenedCallback = callback;
23 | }
24 | void RegisterClosedDelegate(NativeClosedDelegate callback) {
25 | onClosedCallback = callback;
26 | }
27 | void RegisterMessageDelegate(NativeMessageDelegate callback) {
28 | onMessageCallback = callback;
29 | }
30 | void RegisterLogDelegate(NativeLogDelegate callback) {
31 | onLogCallback = callback;
32 | }
33 | void RegisterErrorDelegate(NativeErrorDelegate callback) {
34 | onErrorCallback = callback;
35 | }
36 |
37 | // Implement the Java to C# Event
38 |
39 | JNIEXPORT void JNICALL Java_realtime_droidbridge_BridgeClient_RaiseOpened(JNIEnv *env, jobject o, jint id) {
40 | if (onOpenedCallback != NULL)
41 | {
42 | onOpenedCallback(id);
43 | }
44 | }
45 |
46 | JNIEXPORT void JNICALL Java_realtime_droidbridge_BridgeClient_RaiseClosed(JNIEnv *env, jobject o, jint id) {
47 | if (onClosedCallback != NULL)
48 | {
49 | onClosedCallback(id);
50 | }
51 | }
52 |
53 | JNIEXPORT void JNICALL Java_realtime_droidbridge_BridgeClient_RaiseMessage(JNIEnv *env, jobject o, jint id, jstring m) {
54 | if (onMessageCallback != NULL)
55 | {
56 | onMessageCallback(id, env->GetStringUTFChars(m, 0));
57 | }
58 | }
59 |
60 | JNIEXPORT void JNICALL Java_realtime_droidbridge_BridgeClient_RaiseLog(JNIEnv *env, jobject o, jint id, jstring m) {
61 | if (onLogCallback != NULL)
62 | {
63 | onLogCallback(id, env->GetStringUTFChars(m, 0));
64 | }
65 | }
66 |
67 | JNIEXPORT void JNICALL Java_realtime_droidbridge_BridgeClient_RaiseError(JNIEnv *env, jobject o, jint id, jstring m) {
68 | if (onErrorCallback != NULL)
69 | {
70 | onErrorCallback(id, env->GetStringUTFChars(m, 0));
71 | }
72 | }
73 | }
74 |
--------------------------------------------------------------------------------
/Realtime.DroidBridge/jni/RealtimeDroid.h:
--------------------------------------------------------------------------------
1 |
2 | /**
3 | * Created by Nicholas Ventimiglia on 11/27/2015.
4 | * nick@avariceonline.com
5 | *
6 | * Android Websocket bridge application. Beacause Mono Networking sucks.
7 | * Unity talks with BridgeClient (java) and uses a C Bridge to raise events.
8 | * .NET Methods <--> BridgeClient (Java) -> Bridge (C) --> .net Event
9 | */
10 |
11 | #include
12 | #include
13 |
14 | #ifndef _Included_realtime_droidbridge
15 | #define _Included_realtime_droidbridge
16 |
17 | extern "C" {
18 |
19 | // Define Delegate Type
20 | typedef void (*NativeOpenedDelegate) (int id);
21 | typedef void (*NativeClosedDelegate) (int id);
22 | typedef void (*NativeMessageDelegate) (int id, const char *);
23 | typedef void (*NativeLogDelegate) (int id, const char *);
24 | typedef void (*NativeErrorDelegate) (int id, const char *);
25 |
26 | // Reserve space for Delegate instances
27 | NativeOpenedDelegate onOpenedCallback;
28 | NativeClosedDelegate onClosedCallback;
29 | NativeMessageDelegate onMessageCallback;
30 | NativeLogDelegate onLogCallback;
31 | NativeErrorDelegate onErrorCallback;
32 |
33 | // C# Subscribe method handlers
34 | void RegisterOpenedDelegate (NativeOpenedDelegate callback);
35 | void RegisterClosedDelegate (NativeClosedDelegate callback);
36 | void RegisterMessageDelegate (NativeMessageDelegate callback);
37 | void RegisterLogDelegate (NativeLogDelegate callback);
38 | void RegisterErrorDelegate (NativeErrorDelegate callback);
39 |
40 | // Java Publish Method
41 | JNIEXPORT void JNICALL Java_realtime_droidbridge_BridgeClient_RaiseOpened (JNIEnv *env, jobject o, jint id);
42 | JNIEXPORT void JNICALL Java_realtime_droidbridge_BridgeClient_RaiseClosed (JNIEnv *env, jobject o, jint id);
43 | JNIEXPORT void JNICALL Java_realtime_droidbridge_BridgeClient_RaiseMessage (JNIEnv *env, jobject o, jint id, jstring m);
44 | JNIEXPORT void JNICALL Java_realtime_droidbridge_BridgeClient_RaiseLog (JNIEnv *env, jobject o, jint id, jstring m);
45 | JNIEXPORT void JNICALL Java_realtime_droidbridge_BridgeClient_RaiseError (JNIEnv *env, jobject o, jint id, jstring m);
46 |
47 | }
48 | #endif
--------------------------------------------------------------------------------
/Realtime.DroidBridge/libs/androidasync-2.1.6.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NVentimiglia/Realtime-Unity3d/2d71df4be661f00d721490ef23b7fb12677b698e/Realtime.DroidBridge/libs/androidasync-2.1.6.jar
--------------------------------------------------------------------------------
/Realtime.DroidBridge/libs/armeabi-v7a/libRealtimeDroid.so:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NVentimiglia/Realtime-Unity3d/2d71df4be661f00d721490ef23b7fb12677b698e/Realtime.DroidBridge/libs/armeabi-v7a/libRealtimeDroid.so
--------------------------------------------------------------------------------
/Realtime.DroidBridge/libs/armeabi/libRealtimeDroid.so:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NVentimiglia/Realtime-Unity3d/2d71df4be661f00d721490ef23b7fb12677b698e/Realtime.DroidBridge/libs/armeabi/libRealtimeDroid.so
--------------------------------------------------------------------------------
/Realtime.DroidBridge/libs/x86/libRealtimeDroid.so:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NVentimiglia/Realtime-Unity3d/2d71df4be661f00d721490ef23b7fb12677b698e/Realtime.DroidBridge/libs/x86/libRealtimeDroid.so
--------------------------------------------------------------------------------
/Realtime.DroidBridge/out/artifacts/Realtime_DroidBridge_jar/Realtime.DroidBridge.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NVentimiglia/Realtime-Unity3d/2d71df4be661f00d721490ef23b7fb12677b698e/Realtime.DroidBridge/out/artifacts/Realtime_DroidBridge_jar/Realtime.DroidBridge.jar
--------------------------------------------------------------------------------
/Realtime.DroidBridge/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | DroidBridge
4 |
5 |
--------------------------------------------------------------------------------
/Realtime.DroidBridge/src/realtime/droidbridge/BridgeClient.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Created by Nicholas Ventimiglia on 11/27/2015.
3 | * nick@avariceonline.com
4 | *
5 | * Android Websocket bridge application. Beacause Mono Networking sucks.
6 | * Unity talks with BridgeClient (java) and uses a C Bridge to raise events.
7 | * .NET Methods <--> BridgeClient (Java) -> Bridge (C) -> .net Event
8 | */
9 |
10 | package realtime.droidbridge;
11 |
12 | import android.os.Handler;
13 | import android.os.Looper;
14 | import android.util.Log;
15 |
16 | //https://github.com/koush/AndroidAsync
17 | import com.koushikdutta.async.callback.CompletedCallback;
18 | import com.koushikdutta.async.http.AsyncHttpClient;
19 | import com.koushikdutta.async.http.WebSocket;
20 |
21 | public class BridgeClient
22 | {
23 |
24 | // region Native / Static
25 |
26 | static
27 | {
28 | System.loadLibrary("RealtimeDroid");
29 | }
30 |
31 | @SuppressWarnings("JniMissingFunction")
32 | private native int RaiseOpened (int connectionID);
33 | @SuppressWarnings("JniMissingFunction")
34 | private native void RaiseClosed (int connectionId);
35 | @SuppressWarnings("JniMissingFunction")
36 | private native void RaiseMessage (int connectionId, String message);
37 | @SuppressWarnings("JniMissingFunction")
38 | private native void RaiseLog (int connectionId, String message);
39 | @SuppressWarnings("JniMissingFunction")
40 | private native void RaiseError (int connectionId, String message);
41 |
42 | public static BridgeClient GetInstance()
43 | {
44 | return new BridgeClient();
45 | }
46 |
47 | // endregion
48 |
49 | // region fields
50 | private static int counter = 0;
51 | public final int instanceId;
52 | private Handler mHandler;
53 | private WebSocket mConnection;
54 | private static String TAG = "realtime.droidbridge";
55 | // endregion
56 |
57 | // region Public methods
58 |
59 | public BridgeClient()
60 | {
61 | mHandler = new Handler(Looper.getMainLooper());
62 | instanceId = counter++;
63 | }
64 |
65 | // Support for multiple socket instances
66 | public int GetId()
67 | {
68 | return instanceId;
69 | }
70 |
71 | // connect websocket
72 | public void Open(final String wsuri)
73 | {
74 | AsyncHttpClient.getDefaultInstance().websocket(wsuri, "TLSv1.2", new AsyncHttpClient
75 | .WebSocketConnectCallback()
76 | {
77 | @Override
78 | public void onCompleted(Exception ex, WebSocket webSocket)
79 | {
80 | if (ex != null)
81 | {
82 | Error(ex.toString());
83 | return;
84 | }
85 |
86 | mConnection = webSocket;
87 |
88 | mHandler.post(new Runnable()
89 | {
90 | @Override
91 | public void run()
92 | {
93 | RaiseOpened(instanceId);
94 | }
95 | });
96 |
97 | webSocket.setClosedCallback(new CompletedCallback()
98 | {
99 | @Override
100 | public void onCompleted(Exception e)
101 | {
102 | mHandler.post(new Runnable()
103 | {
104 | @Override
105 | public void run()
106 | {
107 | RaiseClosed(instanceId);
108 | mConnection = null;
109 | }
110 | });
111 | }
112 | });
113 |
114 |
115 | webSocket.setStringCallback(new WebSocket.StringCallback()
116 | {
117 | public void onStringAvailable(final String s)
118 | {
119 | mHandler.post(new Runnable()
120 | {
121 | @Override
122 | public void run()
123 | {
124 | RaiseMessage(instanceId, s);
125 | }
126 | });
127 | }
128 | });
129 | }
130 | });
131 | }
132 |
133 | // disconnect websocker
134 | public void Close()
135 | {
136 | if(mConnection == null)
137 | return;
138 |
139 | mHandler.post(new Runnable()
140 | {
141 | @Override
142 | public void run()
143 | {
144 | mConnection.close();
145 | }
146 | });
147 | }
148 |
149 | // send a message
150 | public void Send(final String message)
151 | {
152 | if(mConnection == null)
153 | return;
154 |
155 | mHandler.post(new Runnable()
156 | {
157 | @Override
158 | public void run()
159 | {
160 | mConnection.send(message);
161 | }
162 | });
163 | }
164 |
165 | private void Log(final String args)
166 | {
167 | Log.d(TAG, args);
168 | mHandler.post(new Runnable()
169 | {
170 | @Override
171 | public void run()
172 | {
173 | RaiseLog(instanceId, args);
174 | }
175 | });
176 | }
177 |
178 | private void Error(final String args)
179 | {
180 | Log.e(TAG, args);
181 | mHandler.post(new Runnable()
182 | {
183 | @Override
184 | public void run()
185 | {
186 | RaiseError(instanceId, String.format("Error: %s", args));
187 | }
188 | });
189 | }
190 |
191 | // endregion
192 | }
193 |
--------------------------------------------------------------------------------
/Realtime.Ortc.Api/Api/AuthenticationClient.cs:
--------------------------------------------------------------------------------
1 | // -------------------------------------
2 | // Domain : IBT / Realtime.co
3 | // Author : Nicholas Ventimiglia
4 | // Product : Messaging and Storage
5 | // Published : 2014
6 | // -------------------------------------
7 |
8 | using System;
9 | using System.Collections;
10 | using System.Collections.Generic;
11 | using System.Text;
12 | using UnityEngine;
13 |
14 | namespace Realtime.Ortc.Api
15 | {
16 | ///
17 | /// ORTC server side API that contains ORTC factories as plug-ins.
18 | ///
19 | public class AuthenticationClient
20 | {
21 | ///
22 | /// Saves the authentication token channels permissions in the ORTC server.
23 | ///
24 | /// ORTC server URL.
25 | /// Indicates whether the ORTC server is in a cluster.
26 | ///
27 | /// Authentication Token which is generated by the application server, for instance a
28 | /// unique session ID.
29 | ///
30 | /// Indicates whether the authentication token is private (1) or not (0).
31 | /// Application Key that was provided to you together with the ORTC service purchasing.
32 | /// The authentication token time to live, in other words, the allowed activity time (in seconds).
33 | /// The private key provided to you together with the ORTC service purchasing.
34 | /// The channels and their permissions (w: write/read or r: read, case sensitive).
35 | /// True if the authentication was successful or false if it was not.
36 | public static void PostAuthentication(
37 | string url,
38 | bool isCluster,
39 | string authenticationToken,
40 | bool authenticationTokenIsPrivate,
41 | string applicationKey,
42 | int timeToLive,
43 | string privateKey,
44 | Dictionary> permissions,
45 | Action callback
46 | )
47 | {
48 | #region Sanity Checks
49 |
50 | if (string.IsNullOrEmpty(url))
51 | {
52 | callback(new OrtcException(OrtcExceptionReason.InvalidArguments, "URL is null or emptyt."), string.Empty);
53 | }
54 | if (string.IsNullOrEmpty(applicationKey))
55 | {
56 | callback(new OrtcException(OrtcExceptionReason.InvalidArguments, "Application Key is null or empty."),
57 | string.Empty);
58 | }
59 | if (string.IsNullOrEmpty(authenticationToken))
60 | {
61 | callback(
62 | new OrtcException(OrtcExceptionReason.InvalidArguments, "Authentication Token is null or empty."),
63 | string.Empty);
64 | }
65 | if (string.IsNullOrEmpty(privateKey))
66 | {
67 | callback(new OrtcException(OrtcExceptionReason.InvalidArguments, "NoPrivate Key is null or empty."),
68 | string.Empty);
69 | }
70 | if (permissions != null && permissions.Count == 0)
71 | {
72 | callback(new OrtcException(OrtcExceptionReason.InvalidArguments, "No permissions set."), string.Empty);
73 | }
74 |
75 | #endregion
76 |
77 | if (isCluster)
78 | {
79 | ClusterClient.GetClusterServerWithRetry(url, applicationKey, (exception, s) =>
80 | {
81 | if (exception)
82 | {
83 | callback(exception, string.Empty);
84 | }
85 | else
86 | {
87 | RealtimeProxy.Instance.StartCoroutine(PostAuthenticationAsync(s, authenticationToken,
88 | authenticationTokenIsPrivate, applicationKey, timeToLive, privateKey, permissions, callback));
89 | }
90 | });
91 | }
92 | else
93 | {
94 | RealtimeProxy.Instance.StartCoroutine(PostAuthenticationAsync(url, authenticationToken,
95 | authenticationTokenIsPrivate, applicationKey, timeToLive, privateKey, permissions, callback));
96 | }
97 | }
98 |
99 |
100 | private static IEnumerator PostAuthenticationAsync(
101 | string connectionUrl,
102 | string authenticationToken,
103 | bool authenticationTokenIsPrivate,
104 | string applicationKey,
105 | int timeToLive,
106 | string privateKey,
107 | Dictionary> permissions,
108 | Action callback)
109 | {
110 | connectionUrl = connectionUrl[connectionUrl.Length - 1] == '/' ? connectionUrl : connectionUrl + "/";
111 |
112 | var postParameters = string.Format("AT={0}&PVT={1}&AK={2}&TTL={3}&PK={4}", authenticationToken,
113 | authenticationTokenIsPrivate
114 | ? 1
115 | : 0, applicationKey, timeToLive, privateKey);
116 |
117 | if (permissions != null && permissions.Count > 0)
118 | {
119 | postParameters += string.Format("&TP={0}", permissions.Count);
120 | foreach (var permission in permissions)
121 | {
122 | var permissionItemText = string.Format("{0}=", permission.Key);
123 | var list = new List(permission.Value);
124 | foreach (var permissionItemValue in list)
125 | {
126 | permissionItemText += ((char) permissionItemValue).ToString();
127 | }
128 |
129 | postParameters += string.Format("&{0}", permissionItemText);
130 | }
131 | }
132 |
133 | var post = Encoding.UTF8.GetBytes(postParameters);
134 | var www = new WWW(string.Format("{0}authenticate", connectionUrl), post);
135 | yield return www;
136 |
137 |
138 | if (!string.IsNullOrEmpty(www.error))
139 | {
140 | Debug.LogError(www.error);
141 | callback(
142 | new OrtcException(OrtcExceptionReason.Unauthorized,
143 | string.Format("Unable to connect to the authentication server {0}.", connectionUrl)),
144 | string.Empty);
145 | }
146 | else
147 | {
148 | callback(null, www.text);
149 | }
150 | }
151 | }
152 | }
--------------------------------------------------------------------------------
/Realtime.Ortc.Api/Api/BalancerClient.cs:
--------------------------------------------------------------------------------
1 | // -------------------------------------
2 | // Domain : IBT / Realtime.co
3 | // Author : Nicholas Ventimiglia
4 | // Product : Messaging and Storage
5 | // Published : 2014
6 | // -------------------------------------
7 |
8 | using System;
9 | using System.Collections;
10 | using System.Text.RegularExpressions;
11 | using UnityEngine;
12 |
13 | namespace Realtime.Ortc.Api
14 | {
15 | ///
16 | /// A static class containing all the methods to communicate with the Ortc Balancer
17 | ///
18 | public class BalancerClient
19 | {
20 | private const string BalancerServerPattern = "^var SOCKET_SERVER = \"(?http.*)\";$";
21 |
22 | ///
23 | /// Retrieves an Ortc Server url from the Ortc Balancer
24 | ///
25 | ///
26 | ///
27 | ///
28 | ///
29 | public static void GetServerUrl(string url, bool isCluster, string applicationKey,
30 | Action callback)
31 | {
32 | if (!isCluster)
33 | {
34 | callback(null, url);
35 | }
36 | else
37 | {
38 | RealtimeProxy.Instance.StartCoroutine(GetServerFromBalancerAsync(url, isCluster, applicationKey,
39 | callback));
40 | }
41 | }
42 |
43 |
44 | private static IEnumerator GetServerFromBalancerAsync(string url, bool isCluster, string applicationKey,
45 | Action callback)
46 | {
47 | var parsedUrl = string.IsNullOrEmpty(applicationKey) ? url : url + "?appkey=" + applicationKey;
48 |
49 | var www = new WWW(parsedUrl);
50 |
51 | yield return www;
52 |
53 | if (!string.IsNullOrEmpty(www.error))
54 | {
55 | Debug.LogError(www.error);
56 | callback(
57 | new OrtcException(OrtcExceptionReason.ConnectionError, "Failed to get server url from balancer."),
58 | string.Empty);
59 | }
60 | else
61 | {
62 | var match = Regex.Match(www.text, BalancerServerPattern);
63 |
64 | var re = match.Success ? match.Groups["server"].Value : string.Empty;
65 |
66 | callback(null, re);
67 | }
68 | }
69 | }
70 | }
--------------------------------------------------------------------------------
/Realtime.Ortc.Api/Api/BufferedMessage.cs:
--------------------------------------------------------------------------------
1 | // -------------------------------------
2 | // Domain : IBT / Realtime.co
3 | // Author : Nicholas Ventimiglia
4 | // Product : Messaging and Storage
5 | // Published : 2014
6 | // -------------------------------------
7 |
8 | using System;
9 |
10 | namespace Realtime.Ortc.Api
11 | {
12 | ///
13 | /// Class used for message buffering.
14 | ///
15 | public class BufferedMessage : IComparable
16 | {
17 | #region Constructor (1)
18 |
19 | ///
20 | /// Constructor.
21 | ///
22 | ///
23 | ///
24 | public BufferedMessage(int messagePart, string message)
25 | {
26 | MessagePart = messagePart;
27 | Message = message;
28 | }
29 |
30 | #endregion
31 |
32 | ///
33 | /// Compares the message parts to put them in ascending order.
34 | ///
35 | ///
36 | ///
37 | public int CompareTo(object obj)
38 | {
39 | var result = 1;
40 |
41 | if (obj != null && obj.GetType() == typeof (BufferedMessage))
42 | {
43 | var objectToCompare = (BufferedMessage) obj;
44 | result = objectToCompare.MessagePart == MessagePart
45 | ? 0
46 | : objectToCompare.MessagePart > MessagePart ? -1 : 1;
47 | }
48 |
49 | return result;
50 | }
51 |
52 | #region Properties (2)
53 |
54 | public int MessagePart { get; set; }
55 | public string Message { get; set; }
56 |
57 | #endregion
58 | }
59 | }
--------------------------------------------------------------------------------
/Realtime.Ortc.Api/Api/ChannelPermission.cs:
--------------------------------------------------------------------------------
1 | namespace Realtime.Ortc.Api
2 | {
3 | ///
4 | /// The channel permission.
5 | ///
6 | public enum ChannelPermissions
7 | {
8 | ///
9 | /// Read permission
10 | ///
11 | Read = 'r',
12 |
13 | ///
14 | /// Read and Write permission
15 | ///
16 | Write = 'w',
17 |
18 | ///
19 | /// Presence permission
20 | ///
21 | Presence = 'p'
22 | }
23 | }
--------------------------------------------------------------------------------
/Realtime.Ortc.Api/Api/ChannelSubscription.cs:
--------------------------------------------------------------------------------
1 | // -------------------------------------
2 | // Domain : IBT / Realtime.co
3 | // Author : Nicholas Ventimiglia
4 | // Product : Messaging and Storage
5 | // Published : 2014
6 | // -------------------------------------
7 |
8 | namespace Realtime.Ortc.Api
9 | {
10 | ///
11 | /// Details regarding a channel subscription
12 | ///
13 | public class ChannelSubscription
14 | {
15 | private bool _isSubscribed;
16 | private bool _isSubscribing;
17 |
18 | ///
19 | /// Constructor for a new subscription
20 | ///
21 | ///
22 | ///
23 | public ChannelSubscription(bool subscribeOnReconnected, OnMessageDelegate onMessage)
24 | {
25 | SubscribeOnReconnected = subscribeOnReconnected;
26 | OnMessage = onMessage;
27 | IsSubscribed = false;
28 | IsSubscribing = false;
29 | }
30 |
31 | ///
32 | /// Constructor for a new subscription
33 | ///
34 | public ChannelSubscription()
35 | {
36 | }
37 |
38 | ///
39 | /// Is subscribing ?
40 | ///
41 | public bool IsSubscribing
42 | {
43 | get { return _isSubscribing; }
44 | set
45 | {
46 | if (value)
47 | {
48 | _isSubscribed = false;
49 | }
50 | _isSubscribing = value;
51 | }
52 | }
53 |
54 | ///
55 | /// Is Subscribed ?
56 | ///
57 | public bool IsSubscribed
58 | {
59 | get { return _isSubscribed; }
60 | set
61 | {
62 | if (value)
63 | {
64 | _isSubscribing = false;
65 | }
66 | _isSubscribed = value;
67 | }
68 | }
69 |
70 | ///
71 | /// Option to reconnect on disconnect
72 | ///
73 | public bool SubscribeOnReconnected { get; set; }
74 |
75 | ///
76 | /// Channel Message Handler
77 | ///
78 | public OnMessageDelegate OnMessage { get; set; }
79 | }
80 | }
--------------------------------------------------------------------------------
/Realtime.Ortc.Api/Api/ClusterClient.cs:
--------------------------------------------------------------------------------
1 | // -------------------------------------
2 | // Domain : IBT / Realtime.co
3 | // Author : Nicholas Ventimiglia
4 | // Product : Messaging and Storage
5 | // Published : 2014
6 | // -------------------------------------
7 |
8 | using System;
9 | using System.Collections;
10 | using System.Text.RegularExpressions;
11 | using UnityEngine;
12 |
13 | namespace Realtime.Ortc.Api
14 | {
15 | ///
16 | /// Http Client for resolving the cluster url
17 | ///
18 | public class ClusterClient
19 | {
20 | #region static / const
21 |
22 | private const int MaxConnectionAttempts = 10;
23 | private const int RetryThreadSleep = 5;
24 | private const string ResponsePattern = "var SOCKET_SERVER = \"(?.*)\";";
25 |
26 | #endregion
27 |
28 | #region public
29 |
30 | ///
31 | /// Url for the cluster
32 | ///
33 | public string Url;
34 |
35 | ///
36 | /// App key
37 | ///
38 | public string ApplicationKey;
39 |
40 | public ClusterClient()
41 | {
42 | }
43 |
44 | public ClusterClient(string url, string applicationKey)
45 | {
46 | Url = url;
47 | ApplicationKey = applicationKey;
48 | }
49 |
50 | ///
51 | /// Gets the cluster server.
52 | ///
53 | ///
54 | public static void GetClusterServer(string url, string applicationKey, Action callback)
55 | {
56 | RealtimeProxy.Instance.StartCoroutine(GetAsync(url, applicationKey, callback));
57 | }
58 |
59 | ///
60 | /// Does the get cluster server logic.
61 | ///
62 | ///
63 | public static void GetClusterServerWithRetry(string url, string applicationKey,
64 | Action callback)
65 | {
66 | RealtimeProxy.Instance.StartCoroutine(GetClusterServerWithRetryAsync(url, applicationKey, callback, 0));
67 | }
68 |
69 | #endregion
70 |
71 | #region private
72 |
73 | private static IEnumerator GetClusterServerWithRetryAsync(string url, string applicationKey,
74 | Action callback, int retry)
75 | {
76 | if (retry > 0)
77 | {
78 | yield return new WaitForSeconds(RetryThreadSleep);
79 | }
80 |
81 | retry++;
82 |
83 | GetClusterServer(url, applicationKey, (exception, s) =>
84 | {
85 | if (exception == null && !string.IsNullOrEmpty(s))
86 | {
87 | //success
88 | callback(null, s);
89 | }
90 | else
91 | {
92 | //max tries
93 | if (retry > MaxConnectionAttempts)
94 | {
95 | callback(
96 | new OrtcException(OrtcExceptionReason.ConnectionError,
97 | "Unable to connect to the authentication server."), string.Empty);
98 | }
99 | else
100 | {
101 | //retry
102 | RealtimeProxy.Instance.StartCoroutine(GetClusterServerWithRetryAsync(url, applicationKey,
103 | callback, retry));
104 | }
105 | }
106 | });
107 | }
108 |
109 | private static IEnumerator GetAsync(string url, string applicationKey, Action callback)
110 | {
111 | var clusterRequestParameter = !string.IsNullOrEmpty(applicationKey)
112 | ? string.Format("appkey={0}", applicationKey)
113 | : string.Empty;
114 |
115 | var clusterUrl = string.Format("{0}{1}?{2}", url,
116 | !string.IsNullOrEmpty(url) && url[url.Length - 1] != '/' ? "/" : string.Empty, clusterRequestParameter);
117 |
118 | var hTask = new WWW(clusterUrl);
119 |
120 | yield return hTask;
121 |
122 | if (!string.IsNullOrEmpty(hTask.error))
123 | {
124 | Debug.LogError(hTask.error);
125 | callback(new OrtcException(OrtcExceptionReason.ConnectionError,"Unable to connect to the authentication server."), string.Empty);
126 | }
127 | else
128 | {
129 | callback(null, ParseResponse(hTask.text));
130 | }
131 | }
132 |
133 | ///
134 | /// parses the response
135 | ///
136 | ///
137 | ///
138 | private static string ParseResponse(string input)
139 | {
140 | var match = Regex.Match(input, ResponsePattern);
141 |
142 | return match.Groups["host"].Value;
143 | }
144 |
145 | #endregion
146 | }
147 | }
--------------------------------------------------------------------------------
/Realtime.Ortc.Api/Api/OrtcException.cs:
--------------------------------------------------------------------------------
1 | // -------------------------------------
2 | // Domain : IBT / Realtime.co
3 | // Author : Nicholas Ventimiglia
4 | // Product : Messaging and Storage
5 | // Published : 2014
6 | // -------------------------------------
7 |
8 | using System;
9 |
10 | namespace Realtime.Ortc.Api
11 | {
12 | ///
13 | /// The exception returned by the ORTC cleint
14 | ///
15 | public enum OrtcExceptionReason
16 | {
17 | ///
18 | /// Undefined error
19 | ///
20 | GenericError,
21 |
22 | ///
23 | /// Not authorized
24 | ///
25 | Unauthorized,
26 |
27 | ///
28 | /// Failed to receive a response
29 | ///
30 | Timeout,
31 |
32 | ///
33 | /// Communication Error
34 | ///
35 | ConnectionError,
36 |
37 | ///
38 | /// Server Error
39 | ///
40 | ServerError,
41 |
42 | ///
43 | /// Bad Arguments
44 | ///
45 | InvalidArguments
46 |
47 | //
48 | }
49 |
50 | ///
51 | /// An exception thrown by the Ortc service client.
52 | /// Includes a Logic friendly reason code.
53 | ///
54 | public class OrtcException : Exception
55 | {
56 | ///
57 | /// Ctor
58 | ///
59 | public OrtcException()
60 | {
61 | }
62 |
63 | ///
64 | /// Ctor
65 | ///
66 | public OrtcException(OrtcExceptionReason reason)
67 | {
68 | Reason = reason;
69 | }
70 |
71 | ///
72 | /// Ctor
73 | ///
74 | public OrtcException(OrtcExceptionReason reason, string message, Exception innerException)
75 | : base(message, innerException)
76 | {
77 | Reason = reason;
78 | }
79 |
80 | ///
81 | /// Ctor
82 | ///
83 | public OrtcException(OrtcExceptionReason reason, Exception innerException)
84 | : base(innerException.Message, innerException)
85 | {
86 | Reason = reason;
87 | }
88 |
89 | ///
90 | /// Ctor
91 | ///
92 | public OrtcException(OrtcExceptionReason reason, string message)
93 | : base(message)
94 | {
95 | Reason = reason;
96 | }
97 |
98 | ///
99 | /// Ctor
100 | ///
101 | public OrtcException(string message)
102 | : base(message)
103 | {
104 | }
105 |
106 | ///
107 | /// Logic friendly exception reason
108 | ///
109 | public OrtcExceptionReason Reason { get; set; }
110 |
111 | public static bool operator true(OrtcException x)
112 | {
113 | return x != null;
114 | }
115 |
116 | public static bool operator false(OrtcException x)
117 | {
118 | return x == null;
119 | }
120 | }
121 | }
--------------------------------------------------------------------------------
/Realtime.Ortc.Api/Api/Presence.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 |
3 | namespace Realtime.Ortc.Api
4 | {
5 | ///
6 | /// Presence info, such as total subscriptions and metadata.
7 | ///
8 | public class Presence
9 | {
10 | ///
11 | /// Initializes a new instance of the class.
12 | ///
13 | public Presence()
14 | {
15 | Subscriptions = 0;
16 | Metadata = new Dictionary();
17 | }
18 |
19 | ///
20 | /// Gets the subscriptions value.
21 | ///
22 | public long Subscriptions { get; set; }
23 |
24 | ///
25 | /// Gets the first 100 unique metadata.
26 | ///
27 | public Dictionary Metadata { get; set; }
28 | }
29 | }
--------------------------------------------------------------------------------
/Realtime.Ortc.Api/Api/RealtimeProxy.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using UnityEngine;
4 |
5 | namespace Realtime.Ortc.Api
6 | {
7 | ///
8 | /// Utility script for interfacing with unity
9 | ///
10 | [AddComponentMenu("Realtime/MessageProxy")]
11 | public class RealtimeProxy : MonoBehaviour
12 | {
13 | private static readonly object _syncLock = new object();
14 | private static readonly List _oneTime = new List();
15 | private static int counter;
16 |
17 | ///
18 | /// Enables passing callbacks to the main thread.
19 | ///
20 | ///
21 | /// Turn this off if you want to mange threads yourself
22 | ///
23 | public static bool EnableMainThreadCallbacks = true;
24 |
25 | private static RealtimeProxy _instance;
26 | public static RealtimeProxy Instance
27 | {
28 | get
29 | {
30 | if (_instance)
31 | return _instance;
32 |
33 | var go = new GameObject("_RealtimeProxy");
34 | DontDestroyOnLoad(go);
35 | _instance = go.AddComponent();
36 | return _instance;
37 | }
38 | }
39 |
40 | static RealtimeProxy()
41 | {
42 | ConfirmInit();
43 | }
44 |
45 | ///
46 | /// Makes sure we have a proxy instance ready
47 | ///
48 | ///
49 | public static RealtimeProxy ConfirmInit()
50 | {
51 | return Instance;
52 | }
53 |
54 | ///
55 | /// Run an action on the main thread
56 | ///
57 | ///
58 | public static void RunOnMainThread(Action action)
59 | {
60 | if (!EnableMainThreadCallbacks)
61 | {
62 | action();
63 | return;
64 | }
65 |
66 | lock (_syncLock)
67 | {
68 | _oneTime.Add(action);
69 | }
70 | }
71 |
72 |
73 | protected void Update()
74 | {
75 | Action[] actions;
76 | lock (_syncLock)
77 | {
78 | actions = _oneTime.Count > 0 ? _oneTime.ToArray() : null;
79 | _oneTime.Clear();
80 | }
81 |
82 | if(actions != null)
83 | {
84 | for (var i = 0; i < actions.Length; i++)
85 | {
86 | try
87 | {
88 | actions[i]();
89 | }
90 | catch (Exception ex)
91 | {
92 | Debug.LogError(ex);
93 | }
94 | }
95 | }
96 | }
97 | }
98 | }
99 |
--------------------------------------------------------------------------------
/Realtime.Ortc.Api/Api/StringExtensions.cs:
--------------------------------------------------------------------------------
1 | // -------------------------------------
2 | // Domain : IBT / Realtime.co
3 | // Author : Nicholas Ventimiglia
4 | // Product : Messaging and Storage
5 | // Published : 2014
6 | // -------------------------------------
7 |
8 | using System.Text.RegularExpressions;
9 |
10 | namespace Realtime.Ortc.Api
11 | {
12 | ///
13 | /// Class used for String methods extensions.
14 | ///
15 | public static class StringExtensions
16 | {
17 | ///
18 | /// Checks if the input is valid.
19 | ///
20 | /// The s.
21 | ///
22 | public static bool OrtcIsValidInput(this string s)
23 | {
24 | return s != null && Regex.Match(s, @"^[\w-:\/\.]*$").Success;
25 | }
26 |
27 | ///
28 | /// Checks if the URL is valid.
29 | ///
30 | /// The s.
31 | ///
32 | public static bool OrtcIsValidUrl(this string s)
33 | {
34 | return s != null &&
35 | Regex.Match(s, @"^\s*(http|https)://(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(/|/([\w#!:.?+=&%@!\-/]))?\s*$")
36 | .Success;
37 | }
38 | }
39 | }
--------------------------------------------------------------------------------
/Realtime.Ortc.Api/Api/Strings.cs:
--------------------------------------------------------------------------------
1 | // -------------------------------------
2 | // Domain : IBT / Realtime.co
3 | // Author : Nicholas Ventimiglia
4 | // Product : Messaging and Storage
5 | // Published : 2014
6 | // -------------------------------------
7 |
8 | using System;
9 | using System.Text;
10 |
11 | namespace Realtime.Ortc.Api
12 | {
13 | ///
14 | /// Class used for operations with strings.
15 | ///
16 | public class Strings
17 | {
18 | ///
19 | /// Randoms the number.
20 | ///
21 | /// The min.
22 | /// The max.
23 | ///
24 | public static int RandomNumber(int min, int max)
25 | {
26 | var random = new Random();
27 | return random.Next(min, max);
28 | }
29 |
30 | ///
31 | /// Randoms the string.
32 | ///
33 | /// The size.
34 | ///
35 | public static string RandomString(int size)
36 | {
37 | var builder = new StringBuilder();
38 | var random = new Random();
39 | char ch;
40 |
41 | for (var i = 0; i < size; i++)
42 | {
43 | ch = Convert.ToChar(Convert.ToInt32(Math.Floor(26*random.NextDouble() + 65)));
44 | builder.Append(ch);
45 | }
46 |
47 | return builder.ToString();
48 | }
49 |
50 | ///
51 | /// Generates an id.
52 | ///
53 | ///
54 | public static string GenerateId(int size)
55 | {
56 | var g = Guid.NewGuid().ToString().Replace("-", "");
57 |
58 | return g.Substring(0, size);
59 | }
60 | }
61 | }
--------------------------------------------------------------------------------
/Realtime.Ortc.Api/Api/TaskTimer.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections;
3 | using UnityEngine;
4 |
5 | namespace Realtime.Ortc.Api
6 | {
7 | ///
8 | /// X-Platform Timer
9 | ///
10 | public class TaskTimer
11 | {
12 | private Action _elapsed = delegate { };
13 |
14 | ///
15 | /// Run again after elapsed
16 | ///
17 | public bool AutoReset;
18 |
19 | ///
20 | /// seconds
21 | ///
22 | public int Interval = 10;
23 |
24 | ///
25 | /// Is Running
26 | ///
27 | public bool IsRunning { get; protected set; }
28 |
29 | ///
30 | /// Run counter
31 | ///
32 | public int Run { get; protected set; }
33 |
34 | public event Action Elapsed
35 | {
36 | add { _elapsed = (Action) Delegate.Combine(_elapsed, value); }
37 | remove { _elapsed = (Action) Delegate.Remove(_elapsed, value); }
38 | }
39 |
40 | ///
41 | /// Starts Run
42 | ///
43 | public void Start()
44 | {
45 | IsRunning = true;
46 | Run++;
47 | RealtimeProxy.RunOnMainThread(() =>
48 | {
49 | RealtimeProxy.Instance.StartCoroutine(GoAsync(Run));
50 | });
51 | }
52 |
53 | ///
54 | /// Stops Run
55 | ///
56 | public void Stop()
57 | {
58 | IsRunning = false;
59 | Run++;
60 | RealtimeProxy.RunOnMainThread(() =>
61 | {
62 | RealtimeProxy.Instance.StopCoroutine(GoAsync(Run));
63 | });
64 | }
65 |
66 | private void Raise()
67 | {
68 | if (_elapsed != null)
69 | _elapsed();
70 | }
71 |
72 | private IEnumerator GoAsync(int i)
73 | {
74 | yield return new WaitForSeconds(Interval);
75 |
76 | // is running and same run
77 | if (i == Run && IsRunning)
78 | {
79 | Raise();
80 |
81 | if (AutoReset)
82 | Start();
83 | }
84 | }
85 | }
86 | }
--------------------------------------------------------------------------------
/Realtime.Ortc.Api/OrtcFactory.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using UnityEngine;
3 |
4 | namespace Realtime.Ortc
5 | {
6 | ///
7 | /// Factory for creating clients
8 | ///
9 | ///
10 | /// Initialized by platform specific factory
11 | ///
12 | public static class OrtcFactory
13 | {
14 | static Func _create;
15 | static bool _isInit;
16 |
17 | ///
18 | /// creates a platform specific new ortc client
19 | ///
20 | ///
21 | public static IOrtcClient Create()
22 | {
23 | if (!_isInit)
24 | {
25 | Debug.LogError("OrtcFactory not initialized. Please include a platform specific factory.");
26 | return null;
27 | }
28 |
29 | return _create();
30 | }
31 |
32 | ///
33 | /// Initialize from platform specific factory
34 | ///
35 | ///
36 | public static void Init(Func creation)
37 | {
38 | _isInit = true;
39 | _create = creation;
40 | }
41 | }
42 | }
--------------------------------------------------------------------------------
/Realtime.Ortc.Api/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.InteropServices;
3 |
4 | // General Information about an assembly is controlled through the following
5 | // set of attributes. Change these attribute values to modify the information
6 | // associated with an assembly.
7 |
8 | [assembly: AssemblyTitle("Realtime.Messaging")]
9 | [assembly: AssemblyDescription("Realtime pub/sub communication framework for Unity3d.")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("realtime.co")]
12 | [assembly: AssemblyProduct("Realtime.Messaging")]
13 | [assembly: AssemblyCopyright("Copyright © realtime.co 2015")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Setting ComVisible to false makes the types in this assembly not visible
18 | // to COM components. If you need to access a type in this assembly from
19 | // COM, set the ComVisible attribute to true on that type.
20 |
21 | [assembly: ComVisible(false)]
22 |
23 | // The following GUID is for the ID of the typelib if this project is exposed to COM
24 |
25 | [assembly: Guid("6b299070-d820-4f2e-89cd-bb2c8520012e")]
26 |
27 | // Version information for an assembly consists of the following four values:
28 | //
29 | // Major Version
30 | // Minor Version
31 | // Build Number
32 | // Revision
33 | //
34 | // You can specify all the values or you can default the Build and Revision Numbers
35 | // by using the '*' as shown below:
36 | // [assembly: AssemblyVersion("1.0.*")]
37 |
38 | [assembly: AssemblyVersion("1.0.0.0")]
39 | [assembly: AssemblyFileVersion("1.0.0.0")]
--------------------------------------------------------------------------------
/Realtime.Ortc.Api/Realtime..Ortc.Api.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 14
4 | VisualStudioVersion = 14.0.23107.0
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Realtime.Ortc.Api", "Realtime.Ortc.Api.csproj", "{74013B66-4364-4245-8E87-A744B632EDFF}"
7 | EndProject
8 | Global
9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
10 | Debug|Any CPU = Debug|Any CPU
11 | Release|Any CPU = Release|Any CPU
12 | EndGlobalSection
13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
14 | {74013B66-4364-4245-8E87-A744B632EDFF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15 | {74013B66-4364-4245-8E87-A744B632EDFF}.Debug|Any CPU.Build.0 = Debug|Any CPU
16 | {74013B66-4364-4245-8E87-A744B632EDFF}.Release|Any CPU.ActiveCfg = Release|Any CPU
17 | {74013B66-4364-4245-8E87-A744B632EDFF}.Release|Any CPU.Build.0 = Release|Any CPU
18 | EndGlobalSection
19 | GlobalSection(SolutionProperties) = preSolution
20 | HideSolutionNode = FALSE
21 | EndGlobalSection
22 | EndGlobal
23 |
--------------------------------------------------------------------------------
/Realtime.Ortc.Api/Realtime.Ortc.Api.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {74013B66-4364-4245-8E87-A744B632EDFF}
8 | Library
9 | Properties
10 | Realtime.Ortc.Api
11 | Realtime.Ortc.Api
12 | v3.5
13 | 512
14 | Unity Subset v3.5
15 |
16 |
17 | true
18 | full
19 | false
20 | bin\Debug\
21 | DEBUG;TRACE
22 | prompt
23 | 4
24 |
25 |
26 | pdbonly
27 | true
28 | bin\Release\
29 | TRACE
30 | prompt
31 | 4
32 | bin\Release\Realtime.Ortc.Api.xml
33 |
34 |
35 |
36 |
37 | ..\libs\UnityEngine.dll
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 | echo f | xcopy "$(TargetDir)Realtime.Ortc.Api.dll" "$(SolutionDir)..\Realtime.Unity\Assets\Realtime\Plugins\Realtime.Ortc.Api.dll" /D /Y
62 |
63 |
70 |
--------------------------------------------------------------------------------
/Realtime.Unity/Assembly-CSharp-Editor-vs.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Debug
5 | AnyCPU
6 | 10.0.20506
7 | 2.0
8 | {E69B214A-1937-4D7C-61CF-C3CD96FE87A6}
9 | Library
10 | Properties
11 |
12 | Assembly-CSharp-Editor
13 | v3.5
14 | 512
15 | Assets
16 |
17 |
18 | true
19 | full
20 | false
21 | Temp\bin\Debug\
22 | DEBUG;TRACE;UNITY_4_7_0;UNITY_4_7;UNITY_STANDALONE_WIN;ENABLE_MICROPHONE;ENABLE_TEXTUREID_MAP;ENABLE_UNITYEVENTS;ENABLE_NEW_HIERARCHY ;ENABLE_AUDIO_FMOD;UNITY_STANDALONE;ENABLE_TERRAIN;ENABLE_SUBSTANCE;ENABLE_GENERICS;INCLUDE_IL2CPP;INCLUDE_WP8SUPPORT;ENABLE_MOVIES;ENABLE_WWW;ENABLE_IMAGEEFFECTS;ENABLE_4_6_FEATURES;INCLUDE_WP_BLUE_SUPPORT;ENABLE_WEBCAM;INCLUDE_METROSUPPORT;RENDER_SOFTWARE_CURSOR;ENABLE_NETWORK;ENABLE_PHYSICS;UNITY5_SCRIPTING_IN_UNITY4;ENABLE_CACHING;ENABLE_CLOTH;ENABLE_2D_PHYSICS;ENABLE_SHADOWS;ENABLE_AUDIO;ENABLE_NAVMESH_CARVING;ENABLE_DUCK_TYPING;ENABLE_SINGLE_INSTANCE_BUILD_SETTING;ENABLE_MONO;ENABLE_PROFILER;UNITY_EDITOR;UNITY_EDITOR_WIN
23 | prompt
24 | 4
25 | 0169
26 |
27 |
28 | pdbonly
29 | true
30 | Temp\bin\Release\
31 | TRACE
32 | prompt
33 | 4
34 | 0169
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 | D:/Program Files (x86)/Unity4/Editor/Data/Managed/UnityEngine.dll
43 |
44 |
45 | D:/Program Files (x86)/Unity4/Editor/Data/Managed/UnityEditor.dll
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 | D:/Program Files (x86)/Unity4/Editor/Data/UnityExtensions/Unity/GUISystem/4.7.0/Standalone/UnityEngine.UI.dll
54 |
55 |
56 | D:/Program Files (x86)/Unity4/Editor/Data/UnityExtensions/Unity/GUISystem/4.7.0/Editor/UnityEditor.UI.dll
57 |
58 |
59 | E:/Projects/Realtime/Realtime.Unity3d/Realtime.Unity3d/Realtime.Unity/Assets/AssetStoreTools/Editor/AssetStoreTools.dll
60 |
61 |
62 | E:/Projects/Realtime/Realtime.Unity3d/Realtime.Unity3d/Realtime.Unity/Assets/AssetStoreTools/Editor/AssetStoreToolsExtra.dll
63 |
64 |
65 | E:/Projects/Realtime/Realtime.Unity3d/Realtime.Unity3d/Realtime.Unity/Assets/Realtime/Plugins/Realtime.Ortc.Api.dll
66 |
67 |
68 | E:/Projects/Realtime/Realtime.Unity3d/Realtime.Unity3d/Realtime.Unity/Assets/Realtime/Plugins/websocket-sharp.dll
69 |
70 |
71 | E:/Projects/Realtime/Realtime.Unity3d/Realtime.Unity3d/Realtime.Unity/Assets/UnityVS/Editor/SyntaxTree.VisualStudio.Unity.Bridge.dll
72 |
73 |
74 | E:/Projects/Realtime/Realtime.Unity3d/Realtime.Unity3d/Realtime.Unity/Assets/UnityVS/Editor/SyntaxTree.VisualStudio.Unity.Messaging.dll
75 |
76 |
77 | E:/Projects/Realtime/Realtime.Unity3d/Realtime.Unity3d/Realtime.Unity/Assets/UnityVS/Editor/UnityVS.VersionSpecific.dll
78 |
79 |
80 | D:/Program Files (x86)/Unity4/Editor/Data/Managed/UnityEditor.Graphs.dll
81 |
82 |
83 |
84 |
85 | {6420D591-C6A1-7CCE-1604-82B3F06C4A43} Assembly-CSharp-vs
86 |
87 |
88 |
95 |
96 |
97 |
--------------------------------------------------------------------------------
/Realtime.Unity/Assembly-CSharp-Editor.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Debug
5 | AnyCPU
6 | 10.0.20506
7 | 2.0
8 | {E69B214A-1937-4D7C-61CF-C3CD96FE87A6}
9 | Library
10 | Properties
11 |
12 | Assembly-CSharp-Editor
13 | v3.5
14 | 512
15 | Assets
16 |
17 |
18 | true
19 | full
20 | false
21 | Temp\bin\Debug\
22 | DEBUG;TRACE;UNITY_4_7_0;UNITY_4_7;UNITY_STANDALONE_WIN;ENABLE_MICROPHONE;ENABLE_TEXTUREID_MAP;ENABLE_UNITYEVENTS;ENABLE_NEW_HIERARCHY ;ENABLE_AUDIO_FMOD;UNITY_STANDALONE;ENABLE_TERRAIN;ENABLE_SUBSTANCE;ENABLE_GENERICS;INCLUDE_IL2CPP;INCLUDE_WP8SUPPORT;ENABLE_MOVIES;ENABLE_WWW;ENABLE_IMAGEEFFECTS;ENABLE_4_6_FEATURES;INCLUDE_WP_BLUE_SUPPORT;ENABLE_WEBCAM;INCLUDE_METROSUPPORT;RENDER_SOFTWARE_CURSOR;ENABLE_NETWORK;ENABLE_PHYSICS;UNITY5_SCRIPTING_IN_UNITY4;ENABLE_CACHING;ENABLE_CLOTH;ENABLE_2D_PHYSICS;ENABLE_SHADOWS;ENABLE_AUDIO;ENABLE_NAVMESH_CARVING;ENABLE_DUCK_TYPING;ENABLE_SINGLE_INSTANCE_BUILD_SETTING;ENABLE_MONO;ENABLE_PROFILER;UNITY_EDITOR;UNITY_EDITOR_WIN
23 | prompt
24 | 4
25 | 0169
26 |
27 |
28 | pdbonly
29 | true
30 | Temp\bin\Release\
31 | TRACE
32 | prompt
33 | 4
34 | 0169
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 | D:/Program Files (x86)/Unity4/Editor/Data/Managed/UnityEngine.dll
43 |
44 |
45 | D:/Program Files (x86)/Unity4/Editor/Data/Managed/UnityEditor.dll
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 | D:/Program Files (x86)/Unity4/Editor/Data/UnityExtensions/Unity/GUISystem/4.7.0/Standalone/UnityEngine.UI.dll
54 |
55 |
56 | D:/Program Files (x86)/Unity4/Editor/Data/UnityExtensions/Unity/GUISystem/4.7.0/Editor/UnityEditor.UI.dll
57 |
58 |
59 | E:/Projects/Realtime/Realtime.Unity3d/Realtime.Unity3d/Realtime.Unity/Assets/AssetStoreTools/Editor/AssetStoreTools.dll
60 |
61 |
62 | E:/Projects/Realtime/Realtime.Unity3d/Realtime.Unity3d/Realtime.Unity/Assets/AssetStoreTools/Editor/AssetStoreToolsExtra.dll
63 |
64 |
65 | E:/Projects/Realtime/Realtime.Unity3d/Realtime.Unity3d/Realtime.Unity/Assets/Realtime/Plugins/Realtime.Ortc.Api.dll
66 |
67 |
68 | E:/Projects/Realtime/Realtime.Unity3d/Realtime.Unity3d/Realtime.Unity/Assets/Realtime/Plugins/websocket-sharp.dll
69 |
70 |
71 | E:/Projects/Realtime/Realtime.Unity3d/Realtime.Unity3d/Realtime.Unity/Assets/UnityVS/Editor/SyntaxTree.VisualStudio.Unity.Bridge.dll
72 |
73 |
74 | E:/Projects/Realtime/Realtime.Unity3d/Realtime.Unity3d/Realtime.Unity/Assets/UnityVS/Editor/SyntaxTree.VisualStudio.Unity.Messaging.dll
75 |
76 |
77 | E:/Projects/Realtime/Realtime.Unity3d/Realtime.Unity3d/Realtime.Unity/Assets/UnityVS/Editor/UnityVS.VersionSpecific.dll
78 |
79 |
80 | D:/Program Files (x86)/Unity4/Editor/Data/Managed/UnityEditor.Graphs.dll
81 |
82 |
83 |
84 |
85 | {6420D591-C6A1-7CCE-1604-82B3F06C4A43} Assembly-CSharp
86 |
87 |
88 |
95 |
96 |
97 |
--------------------------------------------------------------------------------
/Realtime.Unity/Assembly-CSharp-vs.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Debug
5 | AnyCPU
6 | 10.0.20506
7 | 2.0
8 | {6420D591-C6A1-7CCE-1604-82B3F06C4A43}
9 | Library
10 | Properties
11 |
12 | Assembly-CSharp
13 | v3.5
14 | 512
15 | Assets
16 |
17 |
18 | true
19 | full
20 | false
21 | Temp\bin\Debug\
22 | DEBUG;TRACE;UNITY_4_7_0;UNITY_4_7;UNITY_STANDALONE_WIN;ENABLE_MICROPHONE;ENABLE_TEXTUREID_MAP;ENABLE_UNITYEVENTS;ENABLE_NEW_HIERARCHY ;ENABLE_AUDIO_FMOD;UNITY_STANDALONE;ENABLE_TERRAIN;ENABLE_SUBSTANCE;ENABLE_GENERICS;INCLUDE_IL2CPP;INCLUDE_WP8SUPPORT;ENABLE_MOVIES;ENABLE_WWW;ENABLE_IMAGEEFFECTS;ENABLE_4_6_FEATURES;INCLUDE_WP_BLUE_SUPPORT;ENABLE_WEBCAM;INCLUDE_METROSUPPORT;RENDER_SOFTWARE_CURSOR;ENABLE_NETWORK;ENABLE_PHYSICS;UNITY5_SCRIPTING_IN_UNITY4;ENABLE_CACHING;ENABLE_CLOTH;ENABLE_2D_PHYSICS;ENABLE_SHADOWS;ENABLE_AUDIO;ENABLE_NAVMESH_CARVING;ENABLE_DUCK_TYPING;ENABLE_SINGLE_INSTANCE_BUILD_SETTING;ENABLE_MONO;ENABLE_PROFILER;UNITY_EDITOR;UNITY_EDITOR_WIN
23 | prompt
24 | 4
25 | 0169
26 |
27 |
28 | pdbonly
29 | true
30 | Temp\bin\Release\
31 | TRACE
32 | prompt
33 | 4
34 | 0169
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 | D:/Program Files (x86)/Unity4/Editor/Data/Managed/UnityEngine.dll
43 |
44 |
45 | D:/Program Files (x86)/Unity4/Editor/Data/Managed/UnityEditor.dll
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 | D:/Program Files (x86)/Unity4/Editor/Data/UnityExtensions/Unity/GUISystem/4.7.0/Standalone/UnityEngine.UI.dll
78 |
79 |
80 | E:/Projects/Realtime/Realtime.Unity3d/Realtime.Unity3d/Realtime.Unity/Assets/Realtime/Plugins/Realtime.Ortc.Api.dll
81 |
82 |
83 | E:/Projects/Realtime/Realtime.Unity3d/Realtime.Unity3d/Realtime.Unity/Assets/Realtime/Plugins/websocket-sharp.dll
84 |
85 |
86 |
87 |
94 |
95 |
96 |
--------------------------------------------------------------------------------
/Realtime.Unity/Assembly-CSharp.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Debug
5 | AnyCPU
6 | 10.0.20506
7 | 2.0
8 | {6420D591-C6A1-7CCE-1604-82B3F06C4A43}
9 | Library
10 | Properties
11 |
12 | Assembly-CSharp
13 | v3.5
14 | 512
15 | Assets
16 |
17 |
18 | true
19 | full
20 | false
21 | Temp\bin\Debug\
22 | DEBUG;TRACE;UNITY_4_7_0;UNITY_4_7;UNITY_STANDALONE_WIN;ENABLE_MICROPHONE;ENABLE_TEXTUREID_MAP;ENABLE_UNITYEVENTS;ENABLE_NEW_HIERARCHY ;ENABLE_AUDIO_FMOD;UNITY_STANDALONE;ENABLE_TERRAIN;ENABLE_SUBSTANCE;ENABLE_GENERICS;INCLUDE_IL2CPP;INCLUDE_WP8SUPPORT;ENABLE_MOVIES;ENABLE_WWW;ENABLE_IMAGEEFFECTS;ENABLE_4_6_FEATURES;INCLUDE_WP_BLUE_SUPPORT;ENABLE_WEBCAM;INCLUDE_METROSUPPORT;RENDER_SOFTWARE_CURSOR;ENABLE_NETWORK;ENABLE_PHYSICS;UNITY5_SCRIPTING_IN_UNITY4;ENABLE_CACHING;ENABLE_CLOTH;ENABLE_2D_PHYSICS;ENABLE_SHADOWS;ENABLE_AUDIO;ENABLE_NAVMESH_CARVING;ENABLE_DUCK_TYPING;ENABLE_SINGLE_INSTANCE_BUILD_SETTING;ENABLE_MONO;ENABLE_PROFILER;UNITY_EDITOR;UNITY_EDITOR_WIN
23 | prompt
24 | 4
25 | 0169
26 |
27 |
28 | pdbonly
29 | true
30 | Temp\bin\Release\
31 | TRACE
32 | prompt
33 | 4
34 | 0169
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 | D:/Program Files (x86)/Unity4/Editor/Data/Managed/UnityEngine.dll
43 |
44 |
45 | D:/Program Files (x86)/Unity4/Editor/Data/Managed/UnityEditor.dll
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 | D:/Program Files (x86)/Unity4/Editor/Data/UnityExtensions/Unity/GUISystem/4.7.0/Standalone/UnityEngine.UI.dll
78 |
79 |
80 | E:/Projects/Realtime/Realtime.Unity3d/Realtime.Unity3d/Realtime.Unity/Assets/Realtime/Plugins/Realtime.Ortc.Api.dll
81 |
82 |
83 | E:/Projects/Realtime/Realtime.Unity3d/Realtime.Unity3d/Realtime.Unity/Assets/Realtime/Plugins/websocket-sharp.dll
84 |
85 |
86 |
87 |
94 |
95 |
96 |
--------------------------------------------------------------------------------
/Realtime.Unity/Assets/Realtime.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 3d1a3c52b00f6f14bb80b7ca76bcf53a
3 | folderAsset: yes
4 | timeCreated: 1427332013
5 | licenseType: Free
6 | DefaultImporter:
7 | userData:
8 | assetBundleName:
9 | assetBundleVariant:
10 |
--------------------------------------------------------------------------------
/Realtime.Unity/Assets/Realtime/Demos.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 482dad044d5bec0428786a468f8a1984
3 | folderAsset: yes
4 | timeCreated: 1427344599
5 | licenseType: Free
6 | DefaultImporter:
7 | userData:
8 | assetBundleName:
9 | assetBundleVariant:
10 |
--------------------------------------------------------------------------------
/Realtime.Unity/Assets/Realtime/Demos/LobbyTest.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: a210c94bd4b830045a2c391718b31a16
3 | timeCreated: 1451154431
4 | licenseType: Free
5 | MonoImporter:
6 | serializedVersion: 2
7 | defaultReferences: []
8 | executionOrder: 0
9 | icon: {instanceID: 0}
10 | userData:
11 | assetBundleName:
12 | assetBundleVariant:
13 |
--------------------------------------------------------------------------------
/Realtime.Unity/Assets/Realtime/Demos/LobbyTest.unity:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NVentimiglia/Realtime-Unity3d/2d71df4be661f00d721490ef23b7fb12677b698e/Realtime.Unity/Assets/Realtime/Demos/LobbyTest.unity
--------------------------------------------------------------------------------
/Realtime.Unity/Assets/Realtime/Demos/LobbyTest.unity.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: a619f9901bbbdee4c91ab77fce680f81
3 | timeCreated: 1454041060
4 | licenseType: Free
5 | DefaultImporter:
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/Realtime.Unity/Assets/Realtime/Demos/OrtcExampleScene.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 3445d8a96198cf84b8632204ffc206a7
3 | MonoImporter:
4 | serializedVersion: 2
5 | defaultReferences: []
6 | executionOrder: 0
7 | icon: {instanceID: 0}
8 | userData:
9 |
--------------------------------------------------------------------------------
/Realtime.Unity/Assets/Realtime/Demos/OrtcExampleScene.unity:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NVentimiglia/Realtime-Unity3d/2d71df4be661f00d721490ef23b7fb12677b698e/Realtime.Unity/Assets/Realtime/Demos/OrtcExampleScene.unity
--------------------------------------------------------------------------------
/Realtime.Unity/Assets/Realtime/Demos/OrtcExampleScene.unity.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: ec33a509df31ef540ab2c63eaac7dd6d
3 | DefaultImporter:
4 | userData:
5 |
--------------------------------------------------------------------------------
/Realtime.Unity/Assets/Realtime/Demos/_Terminal.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: b5e9048b2d2e117498b3759bee9aabab
3 | folderAsset: yes
4 | timeCreated: 1427331868
5 | licenseType: Free
6 | DefaultImporter:
7 | userData:
8 | assetBundleName:
9 | assetBundleVariant:
10 |
--------------------------------------------------------------------------------
/Realtime.Unity/Assets/Realtime/Demos/_Terminal/Internal.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: aa773819a08bbd847b1b407a3b6f8efa
3 | folderAsset: yes
4 | timeCreated: 1427331868
5 | licenseType: Free
6 | DefaultImporter:
7 | userData:
8 | assetBundleName:
9 | assetBundleVariant:
10 |
--------------------------------------------------------------------------------
/Realtime.Unity/Assets/Realtime/Demos/_Terminal/Internal/ClearCommand.cs:
--------------------------------------------------------------------------------
1 | // -------------------------------------
2 | // Domain : Avariceonline.com
3 | // Author : Nicholas Ventimiglia
4 | // Product : Unity3d Foundation
5 | // Published : 2015
6 | // -------------------------------------
7 | using UnityEngine;
8 |
9 | namespace Foundation.Debuging.Internal
10 | {
11 | ///
12 | /// Extends the console with a 'clear' command
13 | ///
14 | [AddComponentMenu("Foundation/Terminal/ClearCommand")]
15 | public class ClearCommand : MonoBehaviour
16 | {
17 | protected void Awake()
18 | {
19 | Terminal.Add(new TerminalCommand
20 | {
21 | Label = "Clear",
22 | Method = () => Terminal.Clear()
23 | });
24 | }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/Realtime.Unity/Assets/Realtime/Demos/_Terminal/Internal/ClearCommand.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: de0ee7071d38a1c488937d7d28152841
3 | timeCreated: 1425665611
4 | licenseType: Free
5 | MonoImporter:
6 | serializedVersion: 2
7 | defaultReferences: []
8 | executionOrder: 0
9 | icon: {instanceID: 0}
10 | userData:
11 | assetBundleName:
12 | assetBundleVariant:
13 |
--------------------------------------------------------------------------------
/Realtime.Unity/Assets/Realtime/Demos/_Terminal/Internal/ObservableList.cs:
--------------------------------------------------------------------------------
1 | // -------------------------------------
2 | // Domain : Avariceonline.com
3 | // Author : Nicholas Ventimiglia
4 | // Product : Unity3d Foundation
5 | // Published : 2015
6 | // -------------------------------------
7 | using System;
8 | using System.Collections;
9 | using System.Collections.Generic;
10 |
11 | namespace Foundation.Databinding
12 | {
13 | ///
14 | /// A List with on change delegates
15 | ///
16 | ///
17 | public class ObservableList : IList
18 | {
19 | protected List InternalList = new List();
20 |
21 | public event Action OnAdd;
22 | public event Action OnInset;
23 | public event Action OnRemove;
24 | #pragma warning disable 0067
25 | public event Action OnClear;
26 | #pragma warning restore 0067
27 |
28 |
29 | public IEnumerator GetEnumerator()
30 | {
31 | return InternalList.GetEnumerator();
32 | }
33 |
34 | IEnumerator IEnumerable.GetEnumerator()
35 | {
36 | return InternalList.GetEnumerator();
37 | }
38 |
39 | public int IndexOf(T item)
40 | {
41 | return InternalList.IndexOf(item);
42 | }
43 |
44 | public void Insert(int index, T item)
45 | {
46 | InternalList.Insert(index, item);
47 |
48 | if (OnInset != null)
49 | OnInset(index, item);
50 | }
51 |
52 | public void RemoveAt(int index)
53 | {
54 | InternalList.RemoveAt(index);
55 | }
56 |
57 | public T this[int index]
58 | {
59 | get { return InternalList[index]; }
60 | set { InternalList[index] = value; }
61 | }
62 |
63 | public void Add(T item)
64 | {
65 | InternalList.Add(item);
66 |
67 | if (OnAdd != null)
68 | OnAdd(item);
69 | }
70 |
71 | public void Clear()
72 | {
73 | InternalList.Clear();
74 |
75 | if (OnClear != null)
76 | OnClear();
77 | }
78 |
79 | public bool Contains(T item)
80 | {
81 | return InternalList.Contains(item);
82 | }
83 |
84 | public void CopyTo(T[] array, int arrayIndex)
85 | {
86 | InternalList.CopyTo(array, arrayIndex);
87 | }
88 |
89 | public int Count
90 | {
91 | get { return InternalList.Count; }
92 | }
93 |
94 | public bool IsReadOnly
95 | {
96 | get { return false; }
97 | }
98 |
99 | public bool Remove(T item)
100 | {
101 | if (InternalList.Remove(item))
102 | {
103 | if (OnRemove != null)
104 | OnRemove(item);
105 |
106 | return true;
107 | }
108 |
109 | return false;
110 |
111 | }
112 | }
113 | }
--------------------------------------------------------------------------------
/Realtime.Unity/Assets/Realtime/Demos/_Terminal/Internal/ObservableList.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 5b8e55185932713459d2f883db6e14e3
3 | timeCreated: 1425665611
4 | licenseType: Free
5 | MonoImporter:
6 | serializedVersion: 2
7 | defaultReferences: []
8 | executionOrder: 0
9 | icon: {instanceID: 0}
10 | userData:
11 | assetBundleName:
12 | assetBundleVariant:
13 |
--------------------------------------------------------------------------------
/Realtime.Unity/Assets/Realtime/Demos/_Terminal/Internal/SpamCommand.cs:
--------------------------------------------------------------------------------
1 | // -------------------------------------
2 | // Domain : Avariceonline.com
3 | // Author : Nicholas Ventimiglia
4 | // Product : Unity3d Foundation
5 | // Published : 2015
6 | // -------------------------------------
7 | using System;
8 | using System.Collections;
9 | using UnityEngine;
10 |
11 | namespace Foundation.Debuging.Internal
12 | {
13 | ///
14 | /// Test script
15 | ///
16 | [AddComponentMenu("Foundation/Terminal/SpamCommand")]
17 | public class SpamCommand : MonoBehaviour
18 | {
19 | protected void Awake()
20 | {
21 | Terminal.Add(new TerminalCommand
22 | {
23 | Label = "Spam",
24 | Method = () => StartCoroutine(DoSpam())
25 | });
26 | }
27 |
28 | IEnumerator DoSpam()
29 | {
30 | for (int i = 0; i < 50; i++)
31 | {
32 | yield return new WaitForSeconds(.1f);
33 |
34 | Terminal.Log(DateTime.UtcNow.ToLongTimeString());
35 | }
36 | }
37 | }
38 | }
--------------------------------------------------------------------------------
/Realtime.Unity/Assets/Realtime/Demos/_Terminal/Internal/SpamCommand.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: aa8dcb6c438cc504fa2b10a96d89e218
3 | timeCreated: 1425668501
4 | licenseType: Free
5 | MonoImporter:
6 | serializedVersion: 2
7 | defaultReferences: []
8 | executionOrder: 0
9 | icon: {instanceID: 0}
10 | userData:
11 | assetBundleName:
12 | assetBundleVariant:
13 |
--------------------------------------------------------------------------------
/Realtime.Unity/Assets/Realtime/Demos/_Terminal/Internal/TerminalCommandView.cs:
--------------------------------------------------------------------------------
1 | // -------------------------------------
2 | // Domain : Avariceonline.com
3 | // Author : Nicholas Ventimiglia
4 | // Product : Unity3d Foundation
5 | // Published : 2015
6 | // -------------------------------------
7 | using System;
8 | using UnityEngine;
9 | using UnityEngine.UI;
10 |
11 | namespace Foundation.Debuging.Internal
12 | {
13 | ///
14 | /// Presentation script for a Terminal Button Item
15 | ///
16 | public class TerminalCommandView : MonoBehaviour
17 | {
18 | public TerminalCommand Model { get; set; }
19 |
20 | public Text Label;
21 |
22 | public Action Handler;
23 |
24 | public void OnClick()
25 | {
26 | if (Handler != null)
27 | Handler();
28 | }
29 |
30 | }
31 | }
--------------------------------------------------------------------------------
/Realtime.Unity/Assets/Realtime/Demos/_Terminal/Internal/TerminalCommandView.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 01b397446a9cefe41bb9474a9aeb7fd3
3 | timeCreated: 1425665610
4 | licenseType: Free
5 | MonoImporter:
6 | serializedVersion: 2
7 | defaultReferences: []
8 | executionOrder: 0
9 | icon: {instanceID: 0}
10 | userData:
11 | assetBundleName:
12 | assetBundleVariant:
13 |
--------------------------------------------------------------------------------
/Realtime.Unity/Assets/Realtime/Demos/_Terminal/Internal/TerminalItemView.cs:
--------------------------------------------------------------------------------
1 | // -------------------------------------
2 | // Domain : Avariceonline.com
3 | // Author : Nicholas Ventimiglia
4 | // Product : Unity3d Foundation
5 | // Published : 2015
6 | // -------------------------------------
7 | using UnityEngine;
8 | using UnityEngine.UI;
9 |
10 | namespace Foundation.Debuging.Internal
11 | {
12 | ///
13 | /// Presentation script for a Terminal Text Item
14 | ///
15 | [AddComponentMenu("Foundation/Terminal/TerminalItemView")]
16 | public class TerminalItemView : MonoBehaviour
17 | {
18 | public TerminalItem Model { get; set; }
19 |
20 | public Text Label;
21 | }
22 | }
--------------------------------------------------------------------------------
/Realtime.Unity/Assets/Realtime/Demos/_Terminal/Internal/TerminalItemView.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: ee09d0e47d5738441bc2526d57b17a09
3 | timeCreated: 1425665612
4 | licenseType: Free
5 | MonoImporter:
6 | serializedVersion: 2
7 | defaultReferences: []
8 | executionOrder: 0
9 | icon: {instanceID: 0}
10 | userData:
11 | assetBundleName:
12 | assetBundleVariant:
13 |
--------------------------------------------------------------------------------
/Realtime.Unity/Assets/Realtime/Demos/_Terminal/Internal/TerminalView.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: bcaf0e3760f100140a82131e9631882f
3 | timeCreated: 1425665611
4 | licenseType: Free
5 | MonoImporter:
6 | serializedVersion: 2
7 | defaultReferences: []
8 | executionOrder: 0
9 | icon: {instanceID: 0}
10 | userData:
11 | assetBundleName:
12 | assetBundleVariant:
13 |
--------------------------------------------------------------------------------
/Realtime.Unity/Assets/Realtime/Demos/_Terminal/Terminal.cs:
--------------------------------------------------------------------------------
1 | // -------------------------------------
2 | // Domain : Avariceonline.com
3 | // Author : Nicholas Ventimiglia
4 | // Product : Unity3d Foundation
5 | // Published : 2015
6 | // -------------------------------------
7 |
8 | using Foundation.Databinding;
9 | using UnityEngine;
10 |
11 | namespace Foundation.Debuging
12 | {
13 | ///
14 | /// The Terminal API
15 | ///
16 | public class Terminal
17 | {
18 | #region static
19 | public static readonly Terminal Instance = new Terminal();
20 | #endregion
21 |
22 | #region props / fields
23 |
24 | // Default color of the standard display text.
25 |
26 | public Color LogColor = Color.white;
27 | public Color WarningColor = Color.yellow;
28 | public Color ErrorColor = Color.red;
29 | public Color SuccessColor = Color.green;
30 | public Color InputColor = Color.green;
31 | public Color ImportantColor = Color.cyan;
32 |
33 | public readonly ObservableList Items = new ObservableList();
34 | public readonly ObservableList Commands = new ObservableList();
35 | public readonly ObservableList Interpreters = new ObservableList();
36 |
37 | #endregion
38 |
39 | ///
40 | /// Add Command
41 | ///
42 | public static void Add(TerminalCommand arg)
43 | {
44 | Instance.Commands.Add(arg);
45 | }
46 |
47 | ///
48 | /// Add Interpreter
49 | ///
50 | public static void Add(TerminalInterpreter arg)
51 | {
52 | Instance.Interpreters.Add(arg);
53 | }
54 |
55 |
56 | ///
57 | /// write only
58 | ///
59 | public static void Add(TerminalItem message)
60 | {
61 | Instance.Items.Add(message);
62 | }
63 |
64 | ///
65 | /// write only
66 | ///
67 | public static void Add(object message, TerminalType type)
68 | {
69 | Add(new TerminalItem(type, message.ToString()));
70 | }
71 |
72 | ///
73 | /// write only
74 | ///
75 | public static void Log(object message)
76 | {
77 | Add(new TerminalItem(TerminalType.Log, message.ToString()));
78 | }
79 |
80 | ///
81 | /// write only
82 | ///
83 | public static void LogError(object message)
84 | {
85 | Add(new TerminalItem(TerminalType.Error, message.ToString()));
86 | }
87 |
88 | ///
89 | /// write only
90 | ///
91 | public static void LogWarning(object message)
92 | {
93 | Add(new TerminalItem(TerminalType.Warning, message.ToString()));
94 | }
95 |
96 | ///
97 | /// write only
98 | ///
99 | public static void LogSuccess(object message)
100 | {
101 | Add(new TerminalItem(TerminalType.Success, message.ToString()));
102 | }
103 |
104 | ///
105 | /// write only
106 | ///
107 | public static void LogImportant(object message)
108 | {
109 | Add(new TerminalItem(TerminalType.Important, message.ToString()));
110 | }
111 |
112 | ///
113 | /// write only
114 | ///
115 | public static void LogInput(object message)
116 | {
117 | Add(new TerminalItem(TerminalType.Input, message.ToString()));
118 | }
119 |
120 |
121 | ///
122 | /// Input for a command
123 | ///
124 | ///
125 | public static void Submit(string message)
126 | {
127 | if (string.IsNullOrEmpty(message))
128 | {
129 | LogInput(string.Empty);
130 | return;
131 | }
132 |
133 | message = message.Trim();
134 |
135 | Add(new TerminalItem(TerminalType.Input, message));
136 |
137 | foreach (var interpreter in Instance.Interpreters)
138 | {
139 | interpreter.Method.Invoke(message);
140 | }
141 | }
142 |
143 | ///
144 | /// clear writes
145 | ///
146 | public static void Clear()
147 | {
148 | Instance.Items.Clear();
149 | }
150 | }
151 | }
--------------------------------------------------------------------------------
/Realtime.Unity/Assets/Realtime/Demos/_Terminal/Terminal.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: c0d31a2fde9b1f247b7accbefa451faf
3 | timeCreated: 1451580990
4 | licenseType: Free
5 | MonoImporter:
6 | serializedVersion: 2
7 | defaultReferences: []
8 | executionOrder: 0
9 | icon: {instanceID: 0}
10 | userData:
11 | assetBundleName:
12 | assetBundleVariant:
13 |
--------------------------------------------------------------------------------
/Realtime.Unity/Assets/Realtime/Demos/_Terminal/Terminal.prefab.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 6f2bf694ca907014bbed527957d67e3f
3 | NativeFormatImporter:
4 | userData:
5 |
--------------------------------------------------------------------------------
/Realtime.Unity/Assets/Realtime/Demos/_Terminal/TerminalExample.unity.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: a5396dae58f76584da07a1df929928b2
3 | DefaultImporter:
4 | userData:
5 |
--------------------------------------------------------------------------------
/Realtime.Unity/Assets/Realtime/Demos/_Terminal/TerminalModels.cs:
--------------------------------------------------------------------------------
1 | // -------------------------------------
2 | // Domain : Avariceonline.com
3 | // Author : Nicholas Ventimiglia
4 | // Product : Unity3d Foundation
5 | // Published : 2015
6 | // -------------------------------------
7 | using System;
8 | using UnityEngine;
9 |
10 | namespace Foundation.Debuging
11 | {
12 | ///
13 | /// Message Formatting
14 | ///
15 | public enum TerminalType
16 | {
17 | Log,
18 | Warning,
19 | Error,
20 | Exception,
21 | Success,
22 | Important,
23 | Input,
24 | }
25 |
26 |
27 | ///
28 | /// For processing Text input
29 | ///
30 | public class TerminalInterpreter
31 | {
32 | public string Label;
33 | public Action Method;
34 | }
35 |
36 | ///
37 | /// Button to add to the menu
38 | ///
39 | public class TerminalCommand
40 | {
41 | public string Label;
42 | public Action Method;
43 | }
44 |
45 | ///
46 | /// A Terminal line item
47 | ///
48 | public struct TerminalItem
49 | {
50 | readonly string _text;
51 | public string Text
52 | {
53 | get { return _text; }
54 | }
55 |
56 | readonly string _formatted;
57 | public string Formatted
58 | {
59 | get { return _formatted; }
60 | }
61 |
62 | readonly TerminalType _type;
63 | public TerminalType Type
64 | {
65 | get { return _type; }
66 | }
67 |
68 | readonly Color _color;
69 | public Color Color
70 | {
71 | get { return _color; }
72 | }
73 |
74 | public TerminalItem(TerminalType type, string text)
75 | {
76 | _text = text;
77 | _type = type;
78 | switch (_type)
79 | {
80 | case TerminalType.Warning:
81 | _formatted = string.Format("<< {0}", text);
82 | _color = Terminal.Instance.WarningColor;
83 | break;
84 | case TerminalType.Error:
85 | _formatted = string.Format("<< {0}", text);
86 | _color = Terminal.Instance.ErrorColor;
87 | break;
88 | case TerminalType.Success:
89 | _formatted = string.Format("<< {0}", text);
90 | _color = Terminal.Instance.SuccessColor;
91 | break;
92 | case TerminalType.Important:
93 | _formatted = string.Format("<< {0}", text);
94 | _color = Terminal.Instance.ImportantColor;
95 | break;
96 | case TerminalType.Input:
97 | _formatted = string.Format(">> {0}", text);
98 | _color = Terminal.Instance.InputColor;
99 | break;
100 | default:
101 | _formatted = text;
102 | _color = Terminal.Instance.LogColor;
103 | break;
104 | }
105 | }
106 | }
107 | }
--------------------------------------------------------------------------------
/Realtime.Unity/Assets/Realtime/Demos/_Terminal/TerminalModels.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 1df24833219a438428783475158cc1bf
3 | timeCreated: 1451580990
4 | licenseType: Free
5 | MonoImporter:
6 | serializedVersion: 2
7 | defaultReferences: []
8 | executionOrder: 0
9 | icon: {instanceID: 0}
10 | userData:
11 | assetBundleName:
12 | assetBundleVariant:
13 |
--------------------------------------------------------------------------------
/Realtime.Unity/Assets/Realtime/Lobby.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: e52b7be349677d44a971acd31b141b26
3 | folderAsset: yes
4 | timeCreated: 1451148644
5 | licenseType: Free
6 | DefaultImporter:
7 | userData:
8 | assetBundleName:
9 | assetBundleVariant:
10 |
--------------------------------------------------------------------------------
/Realtime.Unity/Assets/Realtime/Lobby/LobbyMessenger.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Reflection;
4 |
5 | namespace Realtime.Lobby
6 | {
7 | ///
8 | /// Lobby Service message bus
9 | ///
10 | ///
11 | public static class LobbyMessenger where T : class
12 | {
13 | public delegate void LobbyMessageDelegate(string channel, T message);
14 |
15 | ///
16 | /// Event
17 | ///
18 | public static event LobbyMessageDelegate OnMessage = delegate { };
19 |
20 | ///
21 | /// sends a message to subscriptions
22 | ///
23 | ///
24 | public static void Publish(string channel, T message)
25 | {
26 |
27 | OnMessage(channel, message);
28 | }
29 |
30 | ///
31 | /// Adds a route
32 | ///
33 | public static void Subscribe(LobbyMessageDelegate handler)
34 | {
35 | OnMessage += handler;
36 | }
37 |
38 | ///
39 | /// removes a route
40 | ///
41 | public static void Unsubscribe(LobbyMessageDelegate handler)
42 | {
43 | OnMessage -= handler;
44 | }
45 | }
46 |
47 | ///
48 | /// Lobby Service message bus
49 | ///
50 | ///
51 | public static class LobbyMessenger
52 | {
53 | static Dictionary _cache = new Dictionary();
54 |
55 | public static void Publish(string channel, object message, Type type)
56 | {
57 | if (!_cache.ContainsKey(type))
58 | {
59 | _cache.Add(type, typeof(LobbyMessenger<>).MakeGenericType(type).GetMethod("Publish"));
60 | }
61 |
62 | _cache[type].Invoke(null, new[] { channel, message });
63 |
64 | }
65 | }
66 | }
67 |
--------------------------------------------------------------------------------
/Realtime.Unity/Assets/Realtime/Lobby/LobbyMessenger.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: d8e872536f4cbee4f9c8b9b83f01430d
3 | timeCreated: 1451235756
4 | licenseType: Free
5 | MonoImporter:
6 | serializedVersion: 2
7 | defaultReferences: []
8 | executionOrder: 0
9 | icon: {instanceID: 0}
10 | userData:
11 | assetBundleName:
12 | assetBundleVariant:
13 |
--------------------------------------------------------------------------------
/Realtime.Unity/Assets/Realtime/Lobby/LobbyModels.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 14b904e5f2f254947829a196a5513b9c
3 | timeCreated: 1451148645
4 | licenseType: Free
5 | MonoImporter:
6 | serializedVersion: 2
7 | defaultReferences: []
8 | executionOrder: 0
9 | icon: {instanceID: 0}
10 | userData:
11 | assetBundleName:
12 | assetBundleVariant:
13 |
--------------------------------------------------------------------------------
/Realtime.Unity/Assets/Realtime/Lobby/LobbyService.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: b0f5b96419371444e811d6c34f9bcb51
3 | timeCreated: 1451154431
4 | licenseType: Free
5 | MonoImporter:
6 | serializedVersion: 2
7 | defaultReferences: []
8 | executionOrder: 0
9 | icon: {instanceID: 0}
10 | userData:
11 | assetBundleName:
12 | assetBundleVariant:
13 |
--------------------------------------------------------------------------------
/Realtime.Unity/Assets/Realtime/Ortc.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: f2c3a527fe54e93458c30e1312f2e2a7
3 | folderAsset: yes
4 | timeCreated: 1448642302
5 | licenseType: Free
6 | DefaultImporter:
7 | userData:
8 | assetBundleName:
9 | assetBundleVariant:
10 |
--------------------------------------------------------------------------------
/Realtime.Unity/Assets/Realtime/Ortc/Editor.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: c805e68e234dbd54c94cbdc036d3c406
3 | folderAsset: yes
4 | timeCreated: 1451098993
5 | licenseType: Free
6 | DefaultImporter:
7 | userData:
8 | assetBundleName:
9 | assetBundleVariant:
10 |
--------------------------------------------------------------------------------
/Realtime.Unity/Assets/Realtime/Ortc/Editor/OrtcIOSPostProcessor.cs:
--------------------------------------------------------------------------------
1 | #if !UNITY_4_7
2 | using System.IO;
3 | using UnityEditor;
4 | using UnityEditor.Callbacks;
5 | using UnityEditor.iOS.Xcode;
6 |
7 | namespace Assets.Realtime.Ortc.Editor
8 | {
9 | public class OrtcIOSPostProcessor
10 | {
11 | [PostProcessBuild]
12 | public static void ChangeXcodePlist(BuildTarget buildTarget, string pathToBuiltProject)
13 | {
14 | if (buildTarget == BuildTarget.iOS)
15 | {
16 | // Get plist
17 | string plistPath = pathToBuiltProject + "/Info.plist";
18 | PlistDocument plist = new PlistDocument();
19 | plist.ReadFromString(File.ReadAllText(plistPath));
20 |
21 | // Get root
22 | PlistElementDict rootDict = plist.root;
23 |
24 | // IOS9 security
25 | var bgModes = rootDict.CreateDict("NSAppTransportSecurity");
26 | bgModes.SetBoolean("NSAllowsArbitraryLoads", true);
27 | var exModes = bgModes.CreateDict("NSExceptionDomains");
28 | var rt = exModes.CreateDict("realtime.co");
29 | rt.SetBoolean("NSIncludesSubdomains", true);
30 | rt.SetBoolean("NSTemporaryExceptionAllowsInsecureHTTPLoads", true);
31 |
32 | //Obj Linker
33 | string projPath = pathToBuiltProject + "/Unity-iPhone.xcodeproj/project.pbxproj";
34 | PBXProject proj = new PBXProject();
35 | proj.ReadFromString(File.ReadAllText(projPath));
36 | string targetGUID = proj.TargetGuidByName("Unity-iPhone");
37 | proj.AddBuildProperty(targetGUID, "OTHER_LDFLAGS", "-ObjC");
38 | File.WriteAllText(projPath, proj.WriteToString());
39 |
40 | //libicucore
41 | proj.AddFileToBuild(targetGUID, proj.AddFile("usr/lib/libicucore.tbd", "Framework/libicucore.tbd", PBXSourceTree.Sdk));
42 | proj.AddFileToBuild(targetGUID, proj.AddFile("usr/lib/libicucore.tbd", "Framework/libicucore.tbd", PBXSourceTree.Build));
43 |
44 | proj.AddFrameworkToProject(targetGUID, "Security.framework", true);
45 | proj.AddFrameworkToProject(targetGUID, "libicucore.tbd", true);
46 |
47 | // Write to file
48 | File.WriteAllText(plistPath, plist.WriteToString());
49 | }
50 | }
51 | }
52 | }
53 | #endif
--------------------------------------------------------------------------------
/Realtime.Unity/Assets/Realtime/Ortc/Editor/OrtcIOSPostProcessor.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: fa100515bf0f8df48a82cbac00736908
3 | timeCreated: 1451098997
4 | licenseType: Free
5 | MonoImporter:
6 | serializedVersion: 2
7 | defaultReferences: []
8 | executionOrder: 0
9 | icon: {instanceID: 0}
10 | userData:
11 | assetBundleName:
12 | assetBundleVariant:
13 |
--------------------------------------------------------------------------------
/Realtime.Unity/Assets/Realtime/Ortc/Internal.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 601e56ce58cff3b4589744046625c6c7
3 | folderAsset: yes
4 | timeCreated: 1448642938
5 | licenseType: Free
6 | DefaultImporter:
7 | userData:
8 | assetBundleName:
9 | assetBundleVariant:
10 |
--------------------------------------------------------------------------------
/Realtime.Unity/Assets/Realtime/Ortc/Internal/DotNetConnection.cs:
--------------------------------------------------------------------------------
1 | // -------------------------------------
2 | // Domain : IBT / Realtime.co
3 | // Author : Nicholas Ventimiglia
4 | // Product : Messaging and Storage
5 | // Published : 2014
6 | // -------------------------------------
7 |
8 | #if UNITY_EDITOR || (!UNITY_WSA && !UNITY_WEBGL)
9 | using System;
10 | using WebSocketSharp;
11 |
12 | namespace Realtime.Ortc.Internal
13 | {
14 | public class DotNetConnection : IWebSocketConnection
15 | {
16 | #region Attributes (1)
17 |
18 | private WebSocketSharp.WebSocket _websocket;
19 | public bool IsOpen { get; set; }
20 |
21 | #endregion
22 |
23 | public void Dispose()
24 | {
25 | if (_websocket != null)
26 | {
27 | if (_websocket.IsAlive)
28 | _websocket.Close();
29 | _websocket.OnOpen -= _websocket_OnOpen;
30 | _websocket.OnError -= _websocket_OnError;
31 | _websocket.OnClose -= _websocket_OnClose;
32 | _websocket.OnMessage -= _websocket_OnMessage;
33 | }
34 | IsOpen = false;
35 | _websocket = null;
36 | }
37 |
38 | #region Methods - Public (3)
39 |
40 | public void Open(string url)
41 | {
42 | if (url.StartsWith("https"))
43 | {
44 | UnityEngine.Debug.LogWarning("DotNetConnection does not support ssl. This is a limitation of mono.");
45 | url = url.Replace("https", "http");
46 | }
47 |
48 | var connectionUrl = HttpUtility.GenerateConnectionEndpoint(url, false);
49 |
50 | if (_websocket != null)
51 | Dispose();
52 | try
53 | {
54 |
55 | _websocket = new WebSocketSharp.WebSocket(connectionUrl);
56 |
57 | _websocket.OnOpen += _websocket_OnOpen;
58 | _websocket.OnError += _websocket_OnError;
59 | _websocket.OnClose += _websocket_OnClose;
60 | _websocket.OnMessage += _websocket_OnMessage;
61 |
62 | _websocket.Connect();
63 | }
64 | catch (Exception ex)
65 | {
66 | UnityEngine.Debug.LogException(ex);
67 | OnError(ex.Message);
68 | }
69 | }
70 |
71 | public void Close()
72 | {
73 | IsOpen = false;
74 | if (_websocket != null)
75 | {
76 | _websocket.Close();
77 | }
78 | }
79 |
80 | public void Send(string message)
81 | {
82 | if (_websocket != null)
83 | {
84 | // Wrap in quotes, escape inner quotes
85 | _websocket.Send(string.Format("\"{0}\"", message.Replace("\"", "\\\"")));
86 | }
87 | }
88 |
89 | #endregion
90 |
91 | #region Methods - Private (1)
92 |
93 | #endregion
94 |
95 | #region Events (4)
96 |
97 | public event OnOpenedDelegate OnOpened = delegate { };
98 | public event OnClosedDelegate OnClosed = delegate { };
99 | public event OnErrorDelegate OnError = delegate { };
100 | public event OnMessageDelegate OnMessage = delegate { };
101 |
102 | #endregion
103 |
104 | #region Events Handles (4)
105 |
106 |
107 | private void _websocket_OnMessage(object sender, MessageEventArgs e)
108 | {
109 | OnMessage(e.Data);
110 | }
111 |
112 | private void _websocket_OnClose(object sender, CloseEventArgs e)
113 | {
114 | IsOpen = false;
115 | OnClosed();
116 | }
117 |
118 | private void _websocket_OnError(object sender, ErrorEventArgs e)
119 | {
120 | OnError(e.Message);
121 | }
122 |
123 | private void _websocket_OnOpen(object sender, EventArgs e)
124 | {
125 | IsOpen = true;
126 | OnOpened();
127 | }
128 |
129 | #endregion
130 | }
131 | }
132 |
133 | #endif
--------------------------------------------------------------------------------
/Realtime.Unity/Assets/Realtime/Ortc/Internal/DotNetConnection.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 1230868399ad4fd448210a56ada543dd
3 | timeCreated: 1448642938
4 | licenseType: Free
5 | MonoImporter:
6 | serializedVersion: 2
7 | defaultReferences: []
8 | executionOrder: 0
9 | icon: {instanceID: 0}
10 | userData:
11 | assetBundleName:
12 | assetBundleVariant:
13 |
--------------------------------------------------------------------------------
/Realtime.Unity/Assets/Realtime/Ortc/Internal/DroidConnection.cs:
--------------------------------------------------------------------------------
1 | // -------------------------------------
2 | // Domain : IBT / Realtime.co
3 | // Author : Nicholas Ventimiglia
4 | // Product : Messaging and Storage
5 | // Published : 2014
6 | // -------------------------------------
7 | #if UNITY_ANDROID
8 | using System.Collections.Generic;
9 | using System.Runtime.InteropServices;
10 | using AOT;
11 | using Realtime.Ortc.Api;
12 | using UnityEngine;
13 |
14 | namespace Realtime.Ortc.Internal
15 | {
16 | ///
17 | /// A Websocket connection via androidBridge application
18 | ///
19 | public class DroidConnection : IWebSocketConnection
20 | {
21 | #region client instance
22 |
23 | public bool IsOpen { get; set; }
24 | public int Id { get; private set; }
25 |
26 | public event OnClosedDelegate OnClosed = delegate { };
27 | public event OnErrorDelegate OnError = delegate { };
28 | public event OnMessageDelegate OnMessage = delegate { };
29 | public event OnOpenedDelegate OnOpened = delegate { };
30 |
31 | private readonly AndroidJavaClass _javaClass;
32 | private readonly AndroidJavaObject _javaObject;
33 |
34 | static readonly Dictionary Connections = new Dictionary();
35 |
36 | public DroidConnection()
37 | {
38 | _javaClass = new AndroidJavaClass("realtime.droidbridge.BridgeClient");
39 | _javaObject = _javaClass.CallStatic("GetInstance");
40 | Id = _javaObject.Call("GetId");
41 | Connections.Add(Id, this);
42 | }
43 |
44 | public void Close()
45 | {
46 | IsOpen = false;
47 | RealtimeProxy.RunOnMainThread(() =>
48 | {
49 | _javaObject.Call("Close");
50 | });
51 | }
52 |
53 | public void Open(string url)
54 | {
55 | var connectionUrl = HttpUtility.GenerateConnectionEndpoint(url, true);
56 |
57 | RealtimeProxy.RunOnMainThread(() =>
58 | {
59 | _javaObject.Call("Open", connectionUrl);
60 | });
61 | }
62 |
63 | public void Dispose()
64 | {
65 | Close();
66 | }
67 |
68 | public void Send(string message)
69 | {
70 | RealtimeProxy.RunOnMainThread(() =>
71 | {
72 | // Wrap in quotes, escape inner quotes
73 | _javaObject.Call("Send", string.Format("\"{0}\"", message.Replace("\"", "\\\"")));
74 | });
75 | }
76 |
77 | //Called by native
78 |
79 | protected void RaiseOpened()
80 | {
81 | IsOpen = true;
82 | OnOpened();
83 | }
84 |
85 | protected void RaiseClosed()
86 | {
87 | IsOpen = false;
88 | OnClosed();
89 | }
90 |
91 | protected void RaiseMessage(string message)
92 | {
93 | OnMessage(message);
94 | }
95 |
96 | protected void RaiseLog(string message)
97 | {
98 | Debug.Log(message);
99 | }
100 |
101 | protected void RaiseError(string message)
102 | {
103 | OnError(message);
104 | }
105 |
106 | #endregion
107 |
108 | #region native
109 |
110 | protected delegate void NativeOpenedDelegate(int id);
111 |
112 | protected delegate void NativeClosedDelegate(int id);
113 |
114 | protected delegate void NativeMessageDelegate(int id, string m);
115 |
116 | protected delegate void NativeLogDelegate(int id, string m);
117 |
118 | protected delegate void NativeErrorDelegate(int id, string m);
119 |
120 | [DllImport("RealtimeDroid")]
121 | protected static extern void RegisterOpenedDelegate(NativeOpenedDelegate callback);
122 |
123 | [DllImport("RealtimeDroid")]
124 | protected static extern void RegisterClosedDelegate(NativeClosedDelegate callback);
125 |
126 | [DllImport("RealtimeDroid")]
127 | protected static extern void RegisterMessageDelegate(NativeMessageDelegate callback);
128 |
129 | [DllImport("RealtimeDroid")]
130 | protected static extern void RegisterLogDelegate(NativeLogDelegate callback);
131 |
132 | [DllImport("RealtimeDroid")]
133 | protected static extern void RegisterErrorDelegate(NativeErrorDelegate callback);
134 |
135 | static DroidConnection()
136 | {
137 | RegisterOpenedDelegate(OnNativeOpened);
138 | RegisterClosedDelegate(OnNativeClosed);
139 | RegisterMessageDelegate(OnNativeMessage);
140 | RegisterLogDelegate(OnNativeLog);
141 | RegisterErrorDelegate(OnNativeError);
142 | }
143 |
144 | [MonoPInvokeCallback(typeof(NativeOpenedDelegate))]
145 | protected static void OnNativeOpened(int id)
146 | {
147 | if (!Connections.ContainsKey(id))
148 | {
149 | Debug.LogError("Droid Client not found : " + id);
150 | return;
151 | }
152 |
153 | Connections[id].RaiseOpened();
154 | }
155 |
156 | [MonoPInvokeCallback(typeof(NativeClosedDelegate))]
157 | protected static void OnNativeClosed(int id)
158 | {
159 | if (!Connections.ContainsKey(id))
160 | {
161 | Debug.LogError("Droid Client not found : " + id);
162 | return;
163 | }
164 |
165 | Connections[id].RaiseClosed();
166 | }
167 |
168 | [MonoPInvokeCallback(typeof(NativeMessageDelegate))]
169 | protected static void OnNativeMessage(int id, string m)
170 | {
171 | if (!Connections.ContainsKey(id))
172 | {
173 | Debug.LogError("Droid Client not found : " + id);
174 | return;
175 | }
176 |
177 | Connections[id].RaiseMessage(m);
178 | }
179 |
180 | [MonoPInvokeCallback(typeof(NativeLogDelegate))]
181 | protected static void OnNativeLog(int id, string m)
182 | {
183 | if (!Connections.ContainsKey(id))
184 | {
185 | Debug.LogError("Droid Client not found : " + id);
186 | return;
187 | }
188 |
189 | Connections[id].RaiseLog(m);
190 | }
191 |
192 | [MonoPInvokeCallback(typeof(NativeErrorDelegate))]
193 | protected static void OnNativeError(int id, string m)
194 | {
195 | if (!Connections.ContainsKey(id))
196 | {
197 | Debug.LogError("Droid Client not found : " + id);
198 | return;
199 | }
200 |
201 | Connections[id].RaiseError(m);
202 | }
203 |
204 |
205 | #endregion
206 | }
207 | }
208 | #endif
--------------------------------------------------------------------------------
/Realtime.Unity/Assets/Realtime/Ortc/Internal/DroidConnection.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 420d08ddcbac245459074f31d0e7f6d2
3 | timeCreated: 1448736769
4 | licenseType: Free
5 | MonoImporter:
6 | serializedVersion: 2
7 | defaultReferences: []
8 | executionOrder: 0
9 | icon: {instanceID: 0}
10 | userData:
11 | assetBundleName:
12 | assetBundleVariant:
13 |
--------------------------------------------------------------------------------
/Realtime.Unity/Assets/Realtime/Ortc/Internal/HttpUtility.cs:
--------------------------------------------------------------------------------
1 | // -------------------------------------
2 | // Domain : IBT / Realtime.co
3 | // Author : Nicholas Ventimiglia
4 | // Product : Messaging and Storage
5 | // Published : 2014
6 | // -------------------------------------
7 |
8 | using System;
9 | using System.Text;
10 | using Realtime.Ortc.Api;
11 |
12 | namespace Realtime.Ortc.Internal
13 | {
14 | internal static class HttpUtility
15 | {
16 | internal static string UrlEncode(string str)
17 | {
18 | if (str == null)
19 | return null;
20 |
21 | return UrlEncode(str, Encoding.UTF8);
22 | }
23 |
24 | internal static string UrlEncode(string str, Encoding e)
25 | {
26 | if (str == null)
27 | return null;
28 |
29 | #if UNITY_WSA
30 | var bytes = UrlEncodeToBytes(str, e);
31 | return Encoding.UTF8.GetString(bytes, 0, bytes.Length);
32 | #else
33 | return Encoding.ASCII.GetString(UrlEncodeToBytes(str, e));
34 | #endif
35 | }
36 |
37 | internal static byte[] UrlEncodeToBytes(string str, Encoding e)
38 | {
39 | if (str == null)
40 | return null;
41 |
42 | var bytes = e.GetBytes(str);
43 | return UrlEncode(bytes, 0, bytes.Length, false);
44 | }
45 |
46 | internal static byte[] UrlEncode(byte[] bytes, int offset, int count, bool alwaysCreateNewReturnValue)
47 | {
48 | var buffer = UrlEncode(bytes, offset, count);
49 | if (alwaysCreateNewReturnValue && buffer != null && buffer == bytes)
50 | return (byte[])buffer.Clone();
51 |
52 | return buffer;
53 | }
54 |
55 | internal static byte[] UrlEncode(byte[] bytes, int offset, int count)
56 | {
57 | if (!ValidateUrlEncodingParameters(bytes, offset, count))
58 | return null;
59 |
60 | var num = 0;
61 | var num2 = 0;
62 | for (var i = 0; i < count; i++)
63 | {
64 | var ch = (char)bytes[offset + i];
65 | if (ch == ' ')
66 | num++;
67 | else if (!IsUrlSafeChar(ch))
68 | num2++;
69 | }
70 |
71 | if (num == 0 && num2 == 0)
72 | return bytes;
73 |
74 | var buffer = new byte[count + num2 * 2];
75 | var num4 = 0;
76 | for (var j = 0; j < count; j++)
77 | {
78 | var num6 = bytes[offset + j];
79 | var ch2 = (char)num6;
80 | if (IsUrlSafeChar(ch2))
81 | {
82 | buffer[num4++] = num6;
83 | }
84 | else if (ch2 == ' ')
85 | {
86 | buffer[num4++] = 0x2b;
87 | }
88 | else
89 | {
90 | buffer[num4++] = 0x25;
91 | buffer[num4++] = (byte)IntToHex((num6 >> 4) & 15);
92 | buffer[num4++] = (byte)IntToHex(num6 & 15);
93 | }
94 | }
95 |
96 | return buffer;
97 | }
98 |
99 | internal static bool IsUrlSafeChar(char ch)
100 | {
101 | if ((ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z') || (ch >= '0' && ch <= '9'))
102 | return true;
103 |
104 | switch (ch)
105 | {
106 | case '(':
107 | case ')':
108 | case '*':
109 | case '-':
110 | case '.':
111 | case '_':
112 | case '!':
113 | return true;
114 | }
115 |
116 | return false;
117 | }
118 |
119 | internal static char IntToHex(int n)
120 | {
121 | if (n <= 9)
122 | return (char)(n + 0x30);
123 |
124 | return (char)(n - 10 + 0x61);
125 | }
126 |
127 | private static bool ValidateUrlEncodingParameters(byte[] bytes, int offset, int count)
128 | {
129 | if (bytes == null && count == 0)
130 | return false;
131 |
132 | if (bytes == null)
133 | throw new ArgumentNullException("bytes");
134 |
135 | if (offset < 0 || offset > bytes.Length)
136 | throw new ArgumentOutOfRangeException("offset");
137 |
138 | if (count < 0 || offset + count > bytes.Length)
139 | throw new ArgumentOutOfRangeException("count");
140 |
141 | return true;
142 | }
143 |
144 | internal static string GenerateConnectionEndpoint(string url, bool canHttps)
145 | {
146 | Uri uri;
147 |
148 | var connectionId = Strings.RandomString(8);
149 | var serverId = Strings.RandomNumber(1, 1000);
150 |
151 | uri = new Uri(url);
152 |
153 | var prefix = "https".Equals(uri.Scheme) && canHttps ? "wss" : "ws";
154 |
155 | var connectionUrl =
156 | new Uri(string.Format("{0}://{1}:{2}/broadcast/{3}/{4}/websocket", prefix, uri.DnsSafeHost, uri.Port,
157 | serverId, connectionId)).AbsoluteUri;
158 |
159 | return connectionUrl;
160 | }
161 | }
162 | }
--------------------------------------------------------------------------------
/Realtime.Unity/Assets/Realtime/Ortc/Internal/HttpUtility.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: a4767025f1e98fa478e5c4108b5a4697
3 | timeCreated: 1448641033
4 | licenseType: Free
5 | MonoImporter:
6 | serializedVersion: 2
7 | defaultReferences: []
8 | executionOrder: 0
9 | icon: {instanceID: 0}
10 | userData:
11 | assetBundleName:
12 | assetBundleVariant:
13 |
--------------------------------------------------------------------------------
/Realtime.Unity/Assets/Realtime/Ortc/Internal/IOSConnection.cs:
--------------------------------------------------------------------------------
1 | // -------------------------------------
2 | // Domain : IBT / Realtime.co
3 | // Author : Nicholas Ventimiglia
4 | // Product : Messaging and Storage
5 | // Published : 2014
6 | // -------------------------------------
7 | #if UNITY_IOS || UNITY_EDITOR
8 | using System.Collections.Generic;
9 | using System.Runtime.InteropServices;
10 | using Realtime.Ortc.Api;
11 | using UnityEngine;
12 |
13 | namespace Realtime.Ortc.Internal
14 | {
15 | ///
16 | /// A Websocket connection via ios bridge application
17 | ///
18 | public class IOSConnection : IWebSocketConnection
19 | {
20 | #region client instance
21 |
22 | public bool IsOpen { get; set; }
23 | public int Id { get; private set; }
24 |
25 | public event OnClosedDelegate OnClosed = delegate { };
26 | public event OnErrorDelegate OnError = delegate { };
27 | public event OnMessageDelegate OnMessage = delegate { };
28 | public event OnOpenedDelegate OnOpened = delegate { };
29 |
30 | static readonly Dictionary Connections = new Dictionary();
31 |
32 | public void Close()
33 | {
34 | IsOpen = false;
35 |
36 | Close(Id);
37 | }
38 |
39 | public void Open(string url)
40 | {
41 | var connectionUrl = HttpUtility.GenerateConnectionEndpoint(url, true);
42 |
43 | Id = Create(connectionUrl);
44 |
45 | Connections.Add(Id, this);
46 | }
47 |
48 | public void Dispose()
49 | {
50 | Close();
51 | }
52 |
53 | public void Send(string message)
54 | {
55 | // Wrap in quotes, escape inner quotes
56 | Send(Id, string.Format("\"{0}\"", message.Replace("\"", "\\\"")));
57 | }
58 |
59 | //Called by native
60 |
61 | protected void RaiseOpened()
62 | {
63 | IsOpen = true;
64 | OnOpened();
65 | }
66 |
67 | protected void RaiseClosed()
68 | {
69 | IsOpen = false;
70 | OnClosed();
71 | }
72 |
73 | protected void RaiseMessage(string message)
74 | {
75 | OnMessage(message);
76 | }
77 |
78 | protected void RaiseLog(string message)
79 | {
80 | Debug.Log(message);
81 | }
82 |
83 | protected void RaiseError(string message)
84 | {
85 | OnError(message);
86 | }
87 |
88 | #endregion
89 |
90 | #region native
91 |
92 | protected delegate void NativeOpenedDelegate(int id);
93 |
94 | protected delegate void NativeClosedDelegate(int id);
95 |
96 | protected delegate void NativeMessageDelegate(int id, string m);
97 |
98 | protected delegate void NativeLogDelegate(int id, string m);
99 |
100 | protected delegate void NativeErrorDelegate(int id, string m);
101 |
102 | [DllImport("__Internal")]
103 | protected static extern void RegisterOpenedDelegate(NativeOpenedDelegate callback);
104 |
105 | [DllImport("__Internal")]
106 | protected static extern void RegisterClosedDelegate(NativeClosedDelegate callback);
107 |
108 | [DllImport("__Internal")]
109 | protected static extern void RegisterMessageDelegate(NativeMessageDelegate callback);
110 |
111 | [DllImport("__Internal")]
112 | protected static extern void RegisterLogDelegate(NativeLogDelegate callback);
113 |
114 | [DllImport("__Internal")]
115 | protected static extern void RegisterErrorDelegate(NativeErrorDelegate callback);
116 |
117 | // Commands
118 |
119 | [DllImport("__Internal")]
120 | protected static extern void Init();
121 |
122 | [DllImport("__Internal")]
123 | protected static extern void Destroy(int id);
124 |
125 | [DllImport("__Internal")]
126 | protected static extern int Create(string url);
127 |
128 | [DllImport("__Internal")]
129 | protected static extern void Send(int clientId, string msg);
130 |
131 | [DllImport("__Internal")]
132 | protected static extern void Close(int clientId);
133 |
134 |
135 | static IOSConnection()
136 | {
137 | Init();
138 | RegisterOpenedDelegate(OnNativeOpened);
139 | RegisterClosedDelegate(OnNativeClosed);
140 | RegisterMessageDelegate(OnNativeMessage);
141 | RegisterLogDelegate(OnNativeLog);
142 | RegisterErrorDelegate(OnNativeError);
143 | }
144 |
145 | [MonoPInvokeCallback(typeof(NativeOpenedDelegate))]
146 | protected static void OnNativeOpened(int id)
147 | {
148 | if (!Connections.ContainsKey(id))
149 | {
150 | Debug.LogError("Droid Client not found : " + id);
151 | return;
152 | }
153 |
154 | Connections[id].RaiseOpened();
155 | }
156 |
157 | [MonoPInvokeCallback(typeof(NativeClosedDelegate))]
158 | protected static void OnNativeClosed(int id)
159 | {
160 | if (!Connections.ContainsKey(id))
161 | {
162 | Debug.LogError("Droid Client not found : " + id);
163 | return;
164 | }
165 |
166 | Connections[id].RaiseClosed();
167 | }
168 |
169 | [MonoPInvokeCallback(typeof(NativeMessageDelegate))]
170 | protected static void OnNativeMessage(int id, string m)
171 | {
172 | if (!Connections.ContainsKey(id))
173 | {
174 | Debug.LogError("Droid Client not found : " + id);
175 | return;
176 | }
177 |
178 | Connections[id].RaiseMessage(m);
179 | }
180 |
181 | [MonoPInvokeCallback(typeof(NativeLogDelegate))]
182 | protected static void OnNativeLog(int id, string m)
183 | {
184 | if (!Connections.ContainsKey(id))
185 | {
186 | Debug.LogError("Droid Client not found : " + id);
187 | return;
188 | }
189 |
190 | Connections[id].RaiseLog(m);
191 | }
192 |
193 | [MonoPInvokeCallback(typeof(NativeErrorDelegate))]
194 | protected static void OnNativeError(int id, string m)
195 | {
196 | if (!Connections.ContainsKey(id))
197 | {
198 | Debug.LogError("Droid Client not found : " + id);
199 | return;
200 | }
201 |
202 | Connections[id].RaiseError(m);
203 | }
204 |
205 |
206 | #endregion
207 | }
208 | }
209 | #endif
--------------------------------------------------------------------------------
/Realtime.Unity/Assets/Realtime/Ortc/Internal/IOSConnection.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 08e00dc5bdfb5d34bbaeea5f7c071b69
3 | timeCreated: 1448813569
4 | licenseType: Free
5 | MonoImporter:
6 | serializedVersion: 2
7 | defaultReferences: []
8 | executionOrder: 0
9 | icon: {instanceID: 0}
10 | userData:
11 | assetBundleName:
12 | assetBundleVariant:
13 |
--------------------------------------------------------------------------------
/Realtime.Unity/Assets/Realtime/Ortc/Internal/IWebSocketConnection.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Realtime.Ortc.Internal
4 | {
5 | public delegate void OnOpenedDelegate();
6 |
7 | public delegate void OnClosedDelegate();
8 |
9 | public delegate void OnErrorDelegate(string error);
10 |
11 | public delegate void OnMessageDelegate(string message);
12 |
13 | public interface IWebSocketConnection : IDisposable
14 | {
15 | bool IsOpen { get; }
16 |
17 | void Open(string url);
18 |
19 | void Close();
20 |
21 | void Send(string message);
22 |
23 | event OnOpenedDelegate OnOpened;
24 |
25 | event OnClosedDelegate OnClosed;
26 |
27 | event OnErrorDelegate OnError;
28 |
29 | event OnMessageDelegate OnMessage;
30 |
31 | }
32 | }
--------------------------------------------------------------------------------
/Realtime.Unity/Assets/Realtime/Ortc/Internal/IWebSocketConnection.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 696dc5fc786b020458ef746e2153a59e
3 | timeCreated: 1448644306
4 | licenseType: Free
5 | MonoImporter:
6 | serializedVersion: 2
7 | defaultReferences: []
8 | executionOrder: 0
9 | icon: {instanceID: 0}
10 | userData:
11 | assetBundleName:
12 | assetBundleVariant:
13 |
--------------------------------------------------------------------------------
/Realtime.Unity/Assets/Realtime/Ortc/Internal/MonoPInvokeCallbackAttribute.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Realtime.Ortc.Internal
4 | {
5 | internal class MonoPInvokeCallbackAttribute : Attribute
6 | {
7 | // ReSharper disable once InconsistentNaming
8 | public Type type;
9 |
10 | public MonoPInvokeCallbackAttribute(Type t)
11 | {
12 | type = t;
13 | }
14 | }
15 | }
--------------------------------------------------------------------------------
/Realtime.Unity/Assets/Realtime/Ortc/Internal/MonoPInvokeCallbackAttribute.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 5b90e6d50ece8eb4196497f5b25dd106
3 | timeCreated: 1451091425
4 | licenseType: Free
5 | MonoImporter:
6 | serializedVersion: 2
7 | defaultReferences: []
8 | executionOrder: 0
9 | icon: {instanceID: 0}
10 | userData:
11 | assetBundleName:
12 | assetBundleVariant:
13 |
--------------------------------------------------------------------------------
/Realtime.Unity/Assets/Realtime/Ortc/Internal/RealtimeDictionary.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: d6dfbe3280821a84c8f49338047367e9
3 | timeCreated: 1448641033
4 | licenseType: Free
5 | MonoImporter:
6 | serializedVersion: 2
7 | defaultReferences: []
8 | executionOrder: 0
9 | icon: {instanceID: 0}
10 | userData:
11 | assetBundleName:
12 | assetBundleVariant:
13 |
--------------------------------------------------------------------------------
/Realtime.Unity/Assets/Realtime/Ortc/Internal/WSAConnection.cs:
--------------------------------------------------------------------------------
1 | // -------------------------------------
2 | // Domain : IBT / Realtime.co
3 | // Author : Nicholas Ventimiglia
4 | // Product : Messaging and Storage
5 | // Published : 2014
6 | // -------------------------------------
7 |
8 | #if UNITY_WSA && !UNITY_EDITOR
9 | using Windows.Web;
10 | using UnityEngine;
11 | using Windows.Foundation;
12 | using Windows.Storage.Streams;
13 | using System.Threading;
14 | using System;
15 | using System.Collections.Generic;
16 | using Windows.Networking.Sockets;
17 | using Windows.Security.Credentials;
18 | using Realtime.Ortc.Api;
19 |
20 | namespace Realtime.Ortc.Internal
21 | {
22 | public class WSAConnection : IWebSocketConnection
23 | {
24 |
25 | #region Events (4)
26 |
27 | public event OnOpenedDelegate OnOpened = delegate { };
28 | public event OnClosedDelegate OnClosed = delegate { };
29 | public event OnErrorDelegate OnError = delegate { };
30 | public event OnMessageDelegate OnMessage = delegate { };
31 |
32 | #endregion
33 |
34 | #region Events Handles (4)
35 |
36 | void MessageReceived(MessageWebSocket sender, MessageWebSocketMessageReceivedEventArgs args)
37 | {
38 | try
39 | {
40 | using (var reader = args.GetDataReader())
41 | {
42 | reader.UnicodeEncoding = UnicodeEncoding.Utf8;
43 | var read = reader.ReadString(reader.UnconsumedBufferLength);
44 | OnMessage(read);
45 | }
46 | }
47 | catch
48 | {
49 |
50 | }
51 |
52 | }
53 |
54 | void Closed(IWebSocket sender, WebSocketClosedEventArgs args)
55 | {
56 | // You can add code to log or display the code and reason
57 | // for the closure (stored in args.Code and args.Reason)
58 |
59 | // This is invoked on another thread so use Interlocked
60 | // to avoid races with the Start/Close/Reset methods.
61 | var webSocket = Interlocked.Exchange(ref streamWebSocket, null);
62 | if (webSocket != null)
63 | {
64 | webSocket.Dispose();
65 | }
66 |
67 | IsOpen = false;
68 | OnClosed();
69 |
70 | streamWebSocket = null;
71 | }
72 |
73 | void RaiseError(string m)
74 | {
75 | OnError(m);
76 | }
77 |
78 | #endregion
79 |
80 | #region Attributes (1)
81 |
82 | private MessageWebSocket pending;
83 | private MessageWebSocket streamWebSocket;
84 | private DataWriter messageWriter;
85 |
86 | public bool IsOpen { get; set; }
87 |
88 | #endregion
89 |
90 | #region Methods - Public (3)
91 |
92 | public async void Open(string url)
93 | {
94 | if (pending != null)
95 | {
96 | pending.Dispose();
97 | }
98 |
99 | //http://stackoverflow.com/questions/26675209/winrt-windows-store-apps-enforcing-to-use-tls12-instead-of-sslv3
100 | //System.Net.ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12;
101 | if (url.StartsWith("https"))
102 | {
103 | Debug.LogWarning("WSAConnection does not support ssl.");
104 | url = url.Replace("https", "http");
105 | }
106 |
107 |
108 |
109 | var connectionUrl = HttpUtility.GenerateConnectionEndpoint(url, false);
110 |
111 | try
112 | {
113 | pending = new MessageWebSocket();
114 | pending.Control.MessageType = SocketMessageType.Utf8;
115 | pending.Closed += Closed;
116 | pending.MessageReceived += MessageReceived;
117 |
118 | try
119 | {
120 | var uri = new Uri(connectionUrl);
121 | await pending.ConnectAsync(uri);
122 | }
123 | catch (Exception ex)
124 | {
125 | Debug.LogException(ex);
126 |
127 | WebErrorStatus status = WebSocketError.GetStatus(ex.GetBaseException().HResult);
128 | switch (status)
129 | {
130 | case WebErrorStatus.CannotConnect:
131 | OnError("Can't connect" + ex.Message);
132 | return;
133 | case WebErrorStatus.NotFound:
134 | OnError("Not found" + ex.Message);
135 | return;
136 | case WebErrorStatus.RequestTimeout:
137 | OnError("Request timeout" + ex.Message);
138 | return;
139 | default:
140 | OnError("unknown " + ex.Message);
141 | return;
142 | }
143 | }
144 |
145 | streamWebSocket = pending;
146 | messageWriter = new DataWriter(pending.OutputStream);
147 | IsOpen = true;
148 | OnOpened();
149 | }
150 | catch
151 | {
152 | throw new OrtcException(OrtcExceptionReason.InvalidArguments, String.Format("Invalid URL: {0}", url));
153 | }
154 | }
155 |
156 | public void Close()
157 | {
158 | if (pending != null)
159 | {
160 | pending.Dispose();
161 | pending = null;
162 | }
163 |
164 | IsOpen = false;
165 | if (streamWebSocket != null)
166 | {
167 | streamWebSocket.Close(1000, "Normal closure");
168 | streamWebSocket.Dispose();
169 | streamWebSocket = null;
170 | }
171 | }
172 |
173 | public async void Send(string message)
174 | {
175 | if (streamWebSocket != null)
176 | {
177 | if (messageWriter != null)
178 | {
179 | try
180 | {
181 | message = "\"" + message + "\"";
182 | messageWriter.WriteString(message);
183 | await ((IAsyncOperation)messageWriter.StoreAsync());
184 | }
185 | catch
186 | {
187 | RaiseError("Send failed");
188 | Close();
189 | }
190 | }
191 | }
192 | }
193 |
194 | #endregion
195 |
196 | public void Dispose()
197 | {
198 | Close();
199 | }
200 | }
201 | }
202 | #endif
--------------------------------------------------------------------------------
/Realtime.Unity/Assets/Realtime/Ortc/Internal/WSAConnection.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: e7c95949f5a6cd54086901aa0d101c87
3 | timeCreated: 1448642939
4 | licenseType: Free
5 | MonoImporter:
6 | serializedVersion: 2
7 | defaultReferences: []
8 | executionOrder: 0
9 | icon: {instanceID: 0}
10 | userData:
11 | assetBundleName:
12 | assetBundleVariant:
13 |
--------------------------------------------------------------------------------
/Realtime.Unity/Assets/Realtime/Ortc/Internal/WebGLBridge.cs:
--------------------------------------------------------------------------------
1 | #if UNITY_WEBGL
2 | using System;
3 | using System.Text;
4 | using System.Collections;
5 | using System.Runtime.InteropServices;
6 |
7 | namespace Realtime.Ortc.Internal
8 | {
9 | public class WebGLBridge
10 | {
11 | private Uri mUrl;
12 |
13 | public WebGLBridge(Uri url)
14 | {
15 | mUrl = url;
16 |
17 | string protocol = mUrl.Scheme;
18 | if (!protocol.Equals("ws") && !protocol.Equals("wss"))
19 | throw new ArgumentException("Unsupported protocol: " + protocol);
20 | }
21 |
22 | public void SendString(string str)
23 | {
24 | Send(Encoding.UTF8.GetBytes (str));
25 | }
26 |
27 | public string RecvString()
28 | {
29 | byte[] retval = Recv();
30 | if (retval == null)
31 | return null;
32 | return Encoding.UTF8.GetString (retval);
33 | }
34 |
35 | [DllImport("__Internal")]
36 | private static extern int SocketCreate (string url);
37 |
38 | [DllImport("__Internal")]
39 | private static extern int SocketState (int socketInstance);
40 |
41 | [DllImport("__Internal")]
42 | private static extern void SocketSend (int socketInstance, byte[] ptr, int length);
43 |
44 | [DllImport("__Internal")]
45 | private static extern void SocketRecv (int socketInstance, byte[] ptr, int length);
46 |
47 | [DllImport("__Internal")]
48 | private static extern int SocketRecvLength (int socketInstance);
49 |
50 | [DllImport("__Internal")]
51 | private static extern void SocketClose (int socketInstance);
52 |
53 | [DllImport("__Internal")]
54 | private static extern int SocketError (int socketInstance, byte[] ptr, int length);
55 |
56 | int m_NativeRef = 0;
57 |
58 | public void Send(byte[] buffer)
59 | {
60 | SocketSend (m_NativeRef, buffer, buffer.Length);
61 | }
62 |
63 | public byte[] Recv()
64 | {
65 | int length = SocketRecvLength (m_NativeRef);
66 | if (length == 0)
67 | return null;
68 | byte[] buffer = new byte[length];
69 | SocketRecv (m_NativeRef, buffer, length);
70 | return buffer;
71 | }
72 |
73 | public IEnumerator Connect()
74 | {
75 | m_NativeRef = SocketCreate (mUrl.ToString());
76 |
77 | while (SocketState(m_NativeRef) == 0)
78 | yield return 0;
79 | }
80 |
81 | public void Close()
82 | {
83 | SocketClose(m_NativeRef);
84 | }
85 |
86 | public string error
87 | {
88 | get {
89 | const int bufsize = 1024;
90 | byte[] buffer = new byte[bufsize];
91 | int result = SocketError (m_NativeRef, buffer, bufsize);
92 |
93 | if (result == 0)
94 | return null;
95 |
96 | return Encoding.UTF8.GetString (buffer);
97 | }
98 | }
99 | }
100 | }
101 | #endif
--------------------------------------------------------------------------------
/Realtime.Unity/Assets/Realtime/Ortc/Internal/WebGLBridge.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: cb576cc0e8b10144cb0dff8adbf261b0
3 | timeCreated: 1448748669
4 | licenseType: Free
5 | MonoImporter:
6 | serializedVersion: 2
7 | defaultReferences: []
8 | executionOrder: 0
9 | icon: {instanceID: 0}
10 | userData:
11 | assetBundleName:
12 | assetBundleVariant:
13 |
--------------------------------------------------------------------------------
/Realtime.Unity/Assets/Realtime/Ortc/Internal/WebGLConnection.cs:
--------------------------------------------------------------------------------
1 | // -------------------------------------
2 | // Domain : IBT / Realtime.co
3 | // Author : Nicholas Ventimiglia
4 | // Product : Messaging and Storage
5 | // Published : 2014
6 | // -------------------------------------
7 |
8 | #if UNITY_WEBGL
9 | using System;
10 | using System.Collections;
11 | using Realtime.Ortc.Api;
12 |
13 | namespace Realtime.Ortc.Internal
14 | {
15 | public class WebGLConnection : IWebSocketConnection
16 | {
17 | #region Events (4)
18 |
19 | public event OnOpenedDelegate OnOpened = delegate { };
20 | public event OnClosedDelegate OnClosed = delegate { };
21 | public event OnErrorDelegate OnError = delegate { };
22 | public event OnMessageDelegate OnMessage = delegate { };
23 |
24 | #endregion
25 |
26 | #region Attributes (1)
27 |
28 | public bool IsOpen { get; set; }
29 | private WebGLBridge _websocket;
30 | private bool connected;
31 | #endregion
32 |
33 | public void Dispose()
34 | {
35 | if (_websocket != null)
36 | Close();
37 | }
38 |
39 | #region Methods - Public (3)
40 |
41 | public void Open(string url)
42 | {
43 | var connectionUrl = HttpUtility.GenerateConnectionEndpoint(url, true);
44 |
45 | if (_websocket != null)
46 | Dispose();
47 |
48 | UnityEngine.Debug.Log("WebGLConnection.Open...");
49 |
50 | _websocket = new WebGLBridge(new Uri(connectionUrl));
51 |
52 | RealtimeProxy.Instance.StartCoroutine(SocketAsync());
53 | }
54 |
55 | public IEnumerator SocketAsync()
56 | {
57 | UnityEngine.Debug.Log("WebGLConnection.SocketAsync...");
58 |
59 | yield return 1;
60 |
61 | yield return RealtimeProxy.Instance.StartCoroutine(_websocket.Connect());
62 |
63 | if (!string.IsNullOrEmpty(_websocket.error))
64 | {
65 | UnityEngine.Debug.Log("WebGLConnection.Connecting Failed !");
66 | OnError(_websocket.error);
67 | OnClosed();
68 | yield break;
69 | }
70 |
71 | UnityEngine.Debug.Log("WebGLConnection.Connecting Success !");
72 | connected = true;
73 | IsOpen = true;
74 | OnOpened();
75 |
76 | while (connected && _websocket != null)
77 | {
78 | var msg = _websocket.RecvString();
79 | if (!string.IsNullOrEmpty(msg))
80 | {
81 | OnMessage(msg);
82 | }
83 | yield return 1;
84 | }
85 | }
86 |
87 | public void Close()
88 | {
89 | UnityEngine.Debug.Log("Close");
90 | connected = false;
91 | IsOpen = false;
92 | RealtimeProxy.Instance.StopCoroutine(SocketAsync());
93 |
94 | if (_websocket != null)
95 | {
96 | _websocket.Close();
97 | OnClosed();
98 | _websocket = null;
99 | }
100 | }
101 |
102 | public void Send(string message)
103 | {
104 | if (_websocket != null)
105 | {
106 | // Wrap in quotes, escape inner quotes
107 | _websocket.SendString(string.Format("\"{0}\"", message.Replace("\"", "\\\"")));
108 | }
109 | }
110 |
111 | #endregion
112 | }
113 | }
114 |
115 | #endif
--------------------------------------------------------------------------------
/Realtime.Unity/Assets/Realtime/Ortc/Internal/WebGLConnection.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 0c76b9c5e4e9c114f8d7eec990bbb32e
3 | timeCreated: 1448642938
4 | licenseType: Free
5 | MonoImporter:
6 | serializedVersion: 2
7 | defaultReferences: []
8 | executionOrder: 0
9 | icon: {instanceID: 0}
10 | userData:
11 | assetBundleName:
12 | assetBundleVariant:
13 |
--------------------------------------------------------------------------------
/Realtime.Unity/Assets/Realtime/Ortc/UnityOrtcClient.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 4d69ec7bef035cf4fb1ac675b12d0f67
3 | timeCreated: 1448642320
4 | licenseType: Free
5 | MonoImporter:
6 | serializedVersion: 2
7 | defaultReferences: []
8 | executionOrder: 0
9 | icon: {instanceID: 0}
10 | userData:
11 | assetBundleName:
12 | assetBundleVariant:
13 |
--------------------------------------------------------------------------------
/Realtime.Unity/Assets/Realtime/Ortc/UnityOrtcStartup.cs:
--------------------------------------------------------------------------------
1 | using Realtime.Ortc.Api;
2 | using UnityEngine;
3 |
4 | namespace Realtime.Ortc
5 | {
6 | ///
7 | /// Configures the Api level Ortc factory with the unity client
8 | ///
9 | internal static class UnityOrtcStartup
10 | {
11 | static bool isConfigured;
12 |
13 | #if UNITY_5
14 | [RuntimeInitializeOnLoadMethod]
15 | #endif
16 | internal static void ConfigureOrtc()
17 | {
18 | if (isConfigured)
19 | return;
20 |
21 | isConfigured = true;
22 |
23 | RealtimeProxy.ConfirmInit();
24 |
25 | //Configure custom clients here.
26 | OrtcFactory.Init(() =>
27 | {
28 | return new UnityOrtcClient();
29 | });
30 | }
31 | }
32 | }
--------------------------------------------------------------------------------
/Realtime.Unity/Assets/Realtime/Ortc/UnityOrtcStartup.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: c5bc4e3b33b19b54fa15b888755b9ee9
3 | timeCreated: 1448643393
4 | licenseType: Free
5 | MonoImporter:
6 | serializedVersion: 2
7 | defaultReferences: []
8 | executionOrder: 0
9 | icon: {instanceID: 0}
10 | userData:
11 | assetBundleName:
12 | assetBundleVariant:
13 |
--------------------------------------------------------------------------------
/Realtime.Unity/Assets/Realtime/Plugins.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: c552372fef139384cbe9c16f8a428528
3 | folderAsset: yes
4 | timeCreated: 1427333742
5 | licenseType: Free
6 | DefaultImporter:
7 | userData:
8 | assetBundleName:
9 | assetBundleVariant:
10 |
--------------------------------------------------------------------------------
/Realtime.Unity/Assets/Realtime/Plugins/IOS.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 67213c16eea72f84f911bdf837dd5a3b
3 | folderAsset: yes
4 | timeCreated: 1451176276
5 | licenseType: Free
6 | DefaultImporter:
7 | userData:
8 | assetBundleName:
9 | assetBundleVariant:
10 |
--------------------------------------------------------------------------------
/Realtime.Unity/Assets/Realtime/Plugins/IOS/IOSBridge.h:
--------------------------------------------------------------------------------
1 | //
2 | // iosBridge.h
3 | // iosBridge
4 | //
5 | // Created by Nicholas Ventimiglia on 7/17/14.
6 | // Copyright (c) 2014 IBT. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "SocketRocket/SRWebSocket.h"
11 |
12 |
13 | // Define Callbacks
14 | #ifdef __cplusplus
15 | extern "C" {
16 | #endif
17 | // Define Delegate Type
18 | typedef void (*NativeOpenedDelegate) (int id);
19 | typedef void (*NativeClosedDelegate) (int id);
20 | typedef void (*NativeMessageDelegate) (int id, const char *);
21 | typedef void (*NativeLogDelegate) (int id, const char *);
22 | typedef void (*NativeErrorDelegate) (int id, const char *);
23 |
24 | #ifdef __cplusplus
25 | }
26 | #endif
27 |
28 | //External API
29 | @interface IOSBridge : NSObject
30 | {
31 | NSMutableArray* _clients;
32 | }
33 |
34 | // Reserve space for Delegate instances
35 | @property NativeOpenedDelegate onOpenedCallback;
36 | @property NativeClosedDelegate onClosedCallback;
37 | @property NativeMessageDelegate onMessageCallback;
38 | @property NativeLogDelegate onLogCallback;
39 | @property NativeErrorDelegate onErrorCallback;
40 |
41 | // Static
42 |
43 | +(IOSBridge*)instance;
44 |
45 | // Methods
46 |
47 | - (void) Destroy:(int)clientId;
48 |
49 | - (int) Create:(NSString*)uri;
50 |
51 | - (void) Close:(int)clientId;
52 |
53 | - (void) Send:(int)clientId
54 | msg:(NSString*)msg;
55 | @end
56 |
--------------------------------------------------------------------------------
/Realtime.Unity/Assets/Realtime/Plugins/IOS/IOSBridge.h.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 9c82c1fa0a297454680fba11bcb191c5
3 | timeCreated: 1451176287
4 | licenseType: Free
5 | PluginImporter:
6 | serializedVersion: 1
7 | iconMap: {}
8 | executionOrder: {}
9 | isPreloaded: 0
10 | platformData:
11 | Android:
12 | enabled: 0
13 | settings:
14 | CPU: AnyCPU
15 | Any:
16 | enabled: 0
17 | settings: {}
18 | Editor:
19 | enabled: 0
20 | settings:
21 | CPU: AnyCPU
22 | DefaultValueInitialized: true
23 | OS: AnyOS
24 | Linux:
25 | enabled: 0
26 | settings:
27 | CPU: x86
28 | Linux64:
29 | enabled: 0
30 | settings:
31 | CPU: x86_64
32 | OSXIntel:
33 | enabled: 0
34 | settings:
35 | CPU: AnyCPU
36 | OSXIntel64:
37 | enabled: 0
38 | settings:
39 | CPU: AnyCPU
40 | Win:
41 | enabled: 0
42 | settings:
43 | CPU: AnyCPU
44 | Win64:
45 | enabled: 0
46 | settings:
47 | CPU: AnyCPU
48 | WindowsStoreApps:
49 | enabled: 0
50 | settings:
51 | CPU: AnyCPU
52 | DontProcess: False
53 | PlaceholderPath:
54 | SDK: AnySDK
55 | ScriptingBackend: AnyScriptingBackend
56 | iOS:
57 | enabled: 1
58 | settings:
59 | CompileFlags:
60 | FrameworkDependencies: Security;
61 | userData:
62 | assetBundleName:
63 | assetBundleVariant:
64 |
--------------------------------------------------------------------------------
/Realtime.Unity/Assets/Realtime/Plugins/IOS/IOSBridge.m:
--------------------------------------------------------------------------------
1 | //
2 | // iosBridge.m
3 | // iosBridge
4 | //
5 | // Created by Nicholas Ventimiglia on 12/28/14.
6 | // Copyright (c) 2014 IBT. All rights reserved.
7 | //
8 |
9 | #import "IOSBridge.h"
10 | #import "SRWebSocket.h"
11 |
12 | // Static
13 | static IOSBridge *instance = nil;
14 |
15 | @implementation IOSBridge;
16 |
17 | // Callbacks
18 | @synthesize onOpenedCallback;
19 | @synthesize onClosedCallback;
20 | @synthesize onMessageCallback;
21 | @synthesize onLogCallback;
22 | @synthesize onErrorCallback;
23 |
24 | // constructor
25 |
26 |
27 | +(IOSBridge*) instance{
28 | if(instance == nil){
29 | NSLog(@"IOSBridge - alloc");
30 | instance = [[IOSBridge alloc] init];
31 | }
32 | return instance;
33 | }
34 |
35 | -(id)init
36 | {
37 | NSLog(@"IOSBridge - init");
38 | self = [super init];
39 | _clients = [[NSMutableArray alloc] init];
40 | return self;
41 | }
42 |
43 | // static factory methods
44 |
45 | -(void)Destroy:(int)clientId
46 | {
47 | NSLog(@"IOSBridge - Destroy");
48 |
49 | SRWebSocket *client = [_clients objectAtIndex:clientId];
50 |
51 | [client close];
52 |
53 | client = nil;
54 |
55 | [_clients replaceObjectAtIndex:clientId withObject:[NSNull null]];
56 | }
57 |
58 | -(SRWebSocket*) getClient:(int) clientId{
59 | return [_clients objectAtIndex:clientId];
60 | }
61 |
62 | // instance methods
63 |
64 | - (int)Create:(NSString *)uri
65 | {
66 | NSLog(@"IOSBridge - Create : %@", uri);
67 |
68 | NSURL *url = [NSURL URLWithString: uri];
69 |
70 | SRWebSocket *ws =[[SRWebSocket alloc] initWithURLRequest:[NSURLRequest requestWithURL:url]];
71 | ws.delegate = self;
72 |
73 | [_clients addObject:ws];
74 |
75 | int clientId = (int)[_clients indexOfObject:ws];
76 |
77 | [ws open];
78 |
79 | return clientId;
80 | }
81 |
82 |
83 | -(void)Close:(int)clientId
84 | {
85 | NSLog(@"IOSBridge - Close");
86 |
87 | SRWebSocket *ws = [instance getClient:clientId];
88 |
89 | [ws close];
90 | }
91 |
92 |
93 |
94 | -(void) Send :(int)clientId
95 | msg:(NSString *)msg
96 | {
97 | SRWebSocket *ws = [instance getClient:clientId];
98 |
99 | [ws send:msg];
100 | }
101 |
102 | #pragma mark - SRWebSocketDelegate
103 |
104 | - (void)webSocketDidOpen:(SRWebSocket *)webSocket;
105 | {
106 | NSLog(@"IOSBridge - Opened");
107 |
108 | int clientId = (int)[_clients indexOfObject:webSocket];
109 |
110 | if(onOpenedCallback != NULL){
111 | onOpenedCallback(clientId);
112 | }
113 | }
114 |
115 | - (void)webSocket:(SRWebSocket *)webSocket didFailWithError:(NSError *)error;
116 | {
117 | NSLog(@"IOSBridge - Error");
118 |
119 | int clientId = (int)[_clients indexOfObject:webSocket];
120 |
121 | if(onErrorCallback != NULL){
122 | onErrorCallback(clientId, [[error localizedDescription]UTF8String]);
123 | }
124 |
125 | if(onClosedCallback != NULL){
126 | onClosedCallback(clientId);
127 | }
128 | }
129 |
130 | - (void)webSocket:(SRWebSocket *)webSocket didReceiveMessage:(id)message;
131 | {
132 | int clientId = (int)[_clients indexOfObject:webSocket];
133 | NSString *value = (NSString *)message;
134 |
135 | if(onMessageCallback != NULL){
136 | onMessageCallback(clientId, [value UTF8String]);
137 | }
138 | }
139 |
140 | - (void)webSocket:(SRWebSocket *)webSocket didCloseWithCode:(NSInteger)code reason:(NSString *)reason wasClean:(BOOL)wasClean;
141 | {
142 | NSLog(@"IOSBridge - Closed with code");
143 |
144 | int clientId = (int)[_clients indexOfObject:webSocket];
145 |
146 | if(onClosedCallback != NULL){
147 | onClosedCallback(clientId);
148 | }
149 | }
150 |
151 | - (void)webSocket:(SRWebSocket *)webSocket didReceivePong:(NSData *)pongPayload;
152 | {
153 | NSLog(@"IOSBridge - Websocket received pong");
154 | }
155 |
156 |
157 | #pragma mark Private methods
158 |
159 | - (void) Log:(int) clientId text:(NSString*) text
160 | {
161 | NSLog(@"IOSBridge %d : %@", clientId, text);
162 |
163 | if(onLogCallback != NULL){
164 | onLogCallback(clientId, [text UTF8String]);
165 | }
166 | }
167 |
168 | @end
169 |
170 | // utility
171 |
172 | // Converts C style string to NSString
173 | NSString* ToNSString (const char* string)
174 | {
175 | if (string)
176 | return [NSString stringWithUTF8String: string];
177 | else
178 | return [NSString stringWithUTF8String: ""];
179 | }
180 |
181 | // Helper method to create C string copy
182 | char* CopyString (const char* string)
183 | {
184 | if (string == NULL)
185 | return NULL;
186 |
187 | char* res = (char*)malloc(strlen(string) + 1);
188 | strcpy(res, string);
189 | return res;
190 | }
191 |
192 | // Native
193 |
194 | #ifdef __cplusplus
195 | extern "C" {
196 | #endif
197 |
198 | // Static
199 |
200 | void Init(){
201 | instance = [IOSBridge instance];
202 | }
203 |
204 | void Destroy(int clientId){
205 | [instance Destroy:clientId];
206 | }
207 |
208 | // Instance
209 |
210 | int Create(const char* path){
211 | return [instance Create:ToNSString(path)];
212 | }
213 |
214 | void Close(int clientId){
215 | [instance Close:clientId];
216 | }
217 |
218 | void Send(int clientId, const char* data){
219 | [instance Send:clientId msg:ToNSString(data)];
220 | }
221 |
222 | // Register Callbacks
223 |
224 | void RegisterOpenedDelegate(NativeOpenedDelegate callback) {
225 | instance.onOpenedCallback = callback;
226 | }
227 | void RegisterClosedDelegate(NativeClosedDelegate callback) {
228 | instance.onClosedCallback = callback;
229 | }
230 | void RegisterMessageDelegate(NativeMessageDelegate callback) {
231 | instance.onMessageCallback = callback;
232 | }
233 | void RegisterLogDelegate(NativeLogDelegate callback) {
234 | instance.onLogCallback = callback;
235 | }
236 | void RegisterErrorDelegate(NativeErrorDelegate callback) {
237 | instance.onErrorCallback = callback;
238 | }
239 |
240 |
241 | #ifdef __cplusplus
242 | }
243 | #endif
244 |
245 |
246 |
247 |
248 |
--------------------------------------------------------------------------------
/Realtime.Unity/Assets/Realtime/Plugins/IOS/IOSBridge.m.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: da4f2db6e934e6a49a43c5e0f0b01f9f
3 | timeCreated: 1451176287
4 | licenseType: Free
5 | PluginImporter:
6 | serializedVersion: 1
7 | iconMap: {}
8 | executionOrder: {}
9 | isPreloaded: 0
10 | platformData:
11 | Android:
12 | enabled: 0
13 | settings:
14 | CPU: AnyCPU
15 | Any:
16 | enabled: 0
17 | settings: {}
18 | Editor:
19 | enabled: 0
20 | settings:
21 | CPU: AnyCPU
22 | DefaultValueInitialized: true
23 | OS: AnyOS
24 | Linux:
25 | enabled: 0
26 | settings:
27 | CPU: x86
28 | Linux64:
29 | enabled: 0
30 | settings:
31 | CPU: x86_64
32 | OSXIntel:
33 | enabled: 0
34 | settings:
35 | CPU: AnyCPU
36 | OSXIntel64:
37 | enabled: 0
38 | settings:
39 | CPU: AnyCPU
40 | Win:
41 | enabled: 0
42 | settings:
43 | CPU: AnyCPU
44 | Win64:
45 | enabled: 0
46 | settings:
47 | CPU: AnyCPU
48 | WindowsStoreApps:
49 | enabled: 0
50 | settings:
51 | CPU: AnyCPU
52 | DontProcess: False
53 | PlaceholderPath:
54 | SDK: AnySDK
55 | ScriptingBackend: AnyScriptingBackend
56 | iOS:
57 | enabled: 1
58 | settings:
59 | CompileFlags:
60 | FrameworkDependencies: Security;
61 | userData:
62 | assetBundleName:
63 | assetBundleVariant:
64 |
--------------------------------------------------------------------------------
/Realtime.Unity/Assets/Realtime/Plugins/IOS/SocketRocket.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 07389d74a70f64d40815dc9ed9c289bc
3 | folderAsset: yes
4 | timeCreated: 1451176287
5 | licenseType: Free
6 | DefaultImporter:
7 | userData:
8 | assetBundleName:
9 | assetBundleVariant:
10 |
--------------------------------------------------------------------------------
/Realtime.Unity/Assets/Realtime/Plugins/IOS/SocketRocket/SRWebSocket.h:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright 2012 Square Inc.
3 | //
4 | // Licensed under the Apache License, Version 2.0 (the "License");
5 | // you may not use this file except in compliance with the License.
6 | // You may obtain a copy of the License at
7 | //
8 | // http://www.apache.org/licenses/LICENSE-2.0
9 | //
10 | // Unless required by applicable law or agreed to in writing, software
11 | // distributed under the License is distributed on an "AS IS" BASIS,
12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | // See the License for the specific language governing permissions and
14 | // limitations under the License.
15 | //
16 |
17 | #import
18 | #import
19 |
20 | typedef NS_ENUM(NSInteger, SRReadyState) {
21 | SR_CONNECTING = 0,
22 | SR_OPEN = 1,
23 | SR_CLOSING = 2,
24 | SR_CLOSED = 3,
25 | };
26 |
27 | typedef enum SRStatusCode : NSInteger {
28 | SRStatusCodeNormal = 1000,
29 | SRStatusCodeGoingAway = 1001,
30 | SRStatusCodeProtocolError = 1002,
31 | SRStatusCodeUnhandledType = 1003,
32 | // 1004 reserved.
33 | SRStatusNoStatusReceived = 1005,
34 | // 1004-1006 reserved.
35 | SRStatusCodeInvalidUTF8 = 1007,
36 | SRStatusCodePolicyViolated = 1008,
37 | SRStatusCodeMessageTooBig = 1009,
38 | } SRStatusCode;
39 |
40 | @class SRWebSocket;
41 |
42 | extern NSString *const SRWebSocketErrorDomain;
43 | extern NSString *const SRHTTPResponseErrorKey;
44 |
45 | #pragma mark - SRWebSocketDelegate
46 |
47 | @protocol SRWebSocketDelegate;
48 |
49 | #pragma mark - SRWebSocket
50 |
51 | @interface SRWebSocket : NSObject
52 |
53 | @property (nonatomic, weak) id delegate;
54 |
55 | @property (nonatomic, readonly) SRReadyState readyState;
56 | @property (nonatomic, readonly, retain) NSURL *url;
57 |
58 |
59 | @property (nonatomic, readonly) CFHTTPMessageRef receivedHTTPHeaders;
60 |
61 | // Optional array of cookies (NSHTTPCookie objects) to apply to the connections
62 | @property (nonatomic, readwrite) NSArray * requestCookies;
63 |
64 | // This returns the negotiated protocol.
65 | // It will be nil until after the handshake completes.
66 | @property (nonatomic, readonly, copy) NSString *protocol;
67 |
68 | // Protocols should be an array of strings that turn into Sec-WebSocket-Protocol.
69 | - (id)initWithURLRequest:(NSURLRequest *)request protocols:(NSArray *)protocols allowsUntrustedSSLCertificates:(BOOL)allowsUntrustedSSLCertificates;
70 | - (id)initWithURLRequest:(NSURLRequest *)request protocols:(NSArray *)protocols;
71 | - (id)initWithURLRequest:(NSURLRequest *)request;
72 |
73 | // Some helper constructors.
74 | - (id)initWithURL:(NSURL *)url protocols:(NSArray *)protocols allowsUntrustedSSLCertificates:(BOOL)allowsUntrustedSSLCertificates;
75 | - (id)initWithURL:(NSURL *)url protocols:(NSArray *)protocols;
76 | - (id)initWithURL:(NSURL *)url;
77 |
78 | // Delegate queue will be dispatch_main_queue by default.
79 | // You cannot set both OperationQueue and dispatch_queue.
80 | - (void)setDelegateOperationQueue:(NSOperationQueue*) queue;
81 | - (void)setDelegateDispatchQueue:(dispatch_queue_t) queue;
82 |
83 | // By default, it will schedule itself on +[NSRunLoop SR_networkRunLoop] using defaultModes.
84 | - (void)scheduleInRunLoop:(NSRunLoop *)aRunLoop forMode:(NSString *)mode;
85 | - (void)unscheduleFromRunLoop:(NSRunLoop *)aRunLoop forMode:(NSString *)mode;
86 |
87 | // SRWebSockets are intended for one-time-use only. Open should be called once and only once.
88 | - (void)open;
89 |
90 | - (void)close;
91 | - (void)closeWithCode:(NSInteger)code reason:(NSString *)reason;
92 |
93 | // Send a UTF8 String or Data.
94 | - (void)send:(id)data;
95 |
96 | // Send Data (can be nil) in a ping message.
97 | - (void)sendPing:(NSData *)data;
98 |
99 | @end
100 |
101 | #pragma mark - SRWebSocketDelegate
102 |
103 | @protocol SRWebSocketDelegate
104 |
105 | // message will either be an NSString if the server is using text
106 | // or NSData if the server is using binary.
107 | - (void)webSocket:(SRWebSocket *)webSocket didReceiveMessage:(id)message;
108 |
109 | @optional
110 |
111 | - (void)webSocketDidOpen:(SRWebSocket *)webSocket;
112 | - (void)webSocket:(SRWebSocket *)webSocket didFailWithError:(NSError *)error;
113 | - (void)webSocket:(SRWebSocket *)webSocket didCloseWithCode:(NSInteger)code reason:(NSString *)reason wasClean:(BOOL)wasClean;
114 | - (void)webSocket:(SRWebSocket *)webSocket didReceivePong:(NSData *)pongPayload;
115 |
116 | @end
117 |
118 | #pragma mark - NSURLRequest (SRCertificateAdditions)
119 |
120 | @interface NSURLRequest (SRCertificateAdditions)
121 |
122 | @property (nonatomic, retain, readonly) NSArray *SR_SSLPinnedCertificates;
123 |
124 | @end
125 |
126 | #pragma mark - NSMutableURLRequest (SRCertificateAdditions)
127 |
128 | @interface NSMutableURLRequest (SRCertificateAdditions)
129 |
130 | @property (nonatomic, retain) NSArray *SR_SSLPinnedCertificates;
131 |
132 | @end
133 |
134 | #pragma mark - NSRunLoop (SRWebSocket)
135 |
136 | @interface NSRunLoop (SRWebSocket)
137 |
138 | + (NSRunLoop *)SR_networkRunLoop;
139 |
140 | @end
141 |
--------------------------------------------------------------------------------
/Realtime.Unity/Assets/Realtime/Plugins/IOS/SocketRocket/SRWebSocket.h.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: af9aea1a77933994e850bf2703483a37
3 | timeCreated: 1451176287
4 | licenseType: Free
5 | PluginImporter:
6 | serializedVersion: 1
7 | iconMap: {}
8 | executionOrder: {}
9 | isPreloaded: 0
10 | platformData:
11 | Android:
12 | enabled: 0
13 | settings:
14 | CPU: AnyCPU
15 | Any:
16 | enabled: 0
17 | settings: {}
18 | Editor:
19 | enabled: 0
20 | settings:
21 | CPU: AnyCPU
22 | DefaultValueInitialized: true
23 | OS: AnyOS
24 | Linux:
25 | enabled: 0
26 | settings:
27 | CPU: x86
28 | Linux64:
29 | enabled: 0
30 | settings:
31 | CPU: x86_64
32 | OSXIntel:
33 | enabled: 0
34 | settings:
35 | CPU: AnyCPU
36 | OSXIntel64:
37 | enabled: 0
38 | settings:
39 | CPU: AnyCPU
40 | Win:
41 | enabled: 0
42 | settings:
43 | CPU: AnyCPU
44 | Win64:
45 | enabled: 0
46 | settings:
47 | CPU: AnyCPU
48 | WindowsStoreApps:
49 | enabled: 0
50 | settings:
51 | CPU: AnyCPU
52 | DontProcess: False
53 | PlaceholderPath:
54 | SDK: AnySDK
55 | ScriptingBackend: AnyScriptingBackend
56 | iOS:
57 | enabled: 1
58 | settings:
59 | CompileFlags:
60 | FrameworkDependencies:
61 | userData:
62 | assetBundleName:
63 | assetBundleVariant:
64 |
--------------------------------------------------------------------------------
/Realtime.Unity/Assets/Realtime/Plugins/IOS/SocketRocket/SRWebSocket.m.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: d8f341845515d534ebdacafb657887bf
3 | timeCreated: 1451176287
4 | licenseType: Free
5 | PluginImporter:
6 | serializedVersion: 1
7 | iconMap: {}
8 | executionOrder: {}
9 | isPreloaded: 0
10 | platformData:
11 | Any:
12 | enabled: 1
13 | settings: {}
14 | userData:
15 | assetBundleName:
16 | assetBundleVariant:
17 |
--------------------------------------------------------------------------------
/Realtime.Unity/Assets/Realtime/Plugins/IOS/SocketRocket/SocketRocket-Prefix.pch.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: ab26eb1214cd49143b7a16a729ea1eea
3 | timeCreated: 1451528555
4 | licenseType: Free
5 | DefaultImporter:
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/Realtime.Unity/Assets/Realtime/Plugins/Realtime.DroidBridge.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NVentimiglia/Realtime-Unity3d/2d71df4be661f00d721490ef23b7fb12677b698e/Realtime.Unity/Assets/Realtime/Plugins/Realtime.DroidBridge.jar
--------------------------------------------------------------------------------
/Realtime.Unity/Assets/Realtime/Plugins/Realtime.DroidBridge.jar.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 11a9fc2a0b3235047ba3056eb6c0fe95
3 | timeCreated: 1448732398
4 | licenseType: Free
5 | PluginImporter:
6 | serializedVersion: 1
7 | iconMap: {}
8 | executionOrder: {}
9 | isPreloaded: 0
10 | platformData:
11 | Any:
12 | enabled: 1
13 | settings: {}
14 | userData:
15 | assetBundleName:
16 | assetBundleVariant:
17 |
--------------------------------------------------------------------------------
/Realtime.Unity/Assets/Realtime/Plugins/Realtime.Ortc.Api.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NVentimiglia/Realtime-Unity3d/2d71df4be661f00d721490ef23b7fb12677b698e/Realtime.Unity/Assets/Realtime/Plugins/Realtime.Ortc.Api.dll
--------------------------------------------------------------------------------
/Realtime.Unity/Assets/Realtime/Plugins/Realtime.Ortc.Api.dll.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 8a8e4a50ef62d57439a185f6534cbec0
3 | timeCreated: 1448813569
4 | licenseType: Free
5 | PluginImporter:
6 | serializedVersion: 1
7 | iconMap: {}
8 | executionOrder: {}
9 | isPreloaded: 0
10 | platformData:
11 | Any:
12 | enabled: 1
13 | settings: {}
14 | Editor:
15 | enabled: 0
16 | settings:
17 | DefaultValueInitialized: true
18 | WindowsStoreApps:
19 | enabled: 0
20 | settings:
21 | CPU: AnyCPU
22 | userData:
23 | assetBundleName:
24 | assetBundleVariant:
25 |
--------------------------------------------------------------------------------
/Realtime.Unity/Assets/Realtime/Plugins/armeabi-v7a.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: b7a6b355a03835649b6a87f34a159c5a
3 | folderAsset: yes
4 | timeCreated: 1451080757
5 | licenseType: Free
6 | DefaultImporter:
7 | userData:
8 | assetBundleName:
9 | assetBundleVariant:
10 |
--------------------------------------------------------------------------------
/Realtime.Unity/Assets/Realtime/Plugins/armeabi-v7a/libRealtimeDroid.so:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NVentimiglia/Realtime-Unity3d/2d71df4be661f00d721490ef23b7fb12677b698e/Realtime.Unity/Assets/Realtime/Plugins/armeabi-v7a/libRealtimeDroid.so
--------------------------------------------------------------------------------
/Realtime.Unity/Assets/Realtime/Plugins/armeabi-v7a/libRealtimeDroid.so.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: bd21046f588d7d84bbc0afe9f75adacb
3 | timeCreated: 1451080759
4 | licenseType: Free
5 | PluginImporter:
6 | serializedVersion: 1
7 | iconMap: {}
8 | executionOrder: {}
9 | isPreloaded: 0
10 | platformData:
11 | Android:
12 | enabled: 1
13 | settings:
14 | CPU: ARMv7
15 | Any:
16 | enabled: 0
17 | settings: {}
18 | Editor:
19 | enabled: 0
20 | settings:
21 | CPU: AnyCPU
22 | DefaultValueInitialized: true
23 | OS: AnyOS
24 | Linux:
25 | enabled: 0
26 | settings:
27 | CPU: x86
28 | Linux64:
29 | enabled: 0
30 | settings:
31 | CPU: x86_64
32 | OSXIntel:
33 | enabled: 0
34 | settings:
35 | CPU: AnyCPU
36 | OSXIntel64:
37 | enabled: 0
38 | settings:
39 | CPU: AnyCPU
40 | Win:
41 | enabled: 0
42 | settings:
43 | CPU: AnyCPU
44 | Win64:
45 | enabled: 0
46 | settings:
47 | CPU: AnyCPU
48 | WindowsStoreApps:
49 | enabled: 0
50 | settings:
51 | CPU: AnyCPU
52 | DontProcess: False
53 | PlaceholderPath:
54 | SDK: AnySDK
55 | ScriptingBackend: AnyScriptingBackend
56 | iOS:
57 | enabled: 0
58 | settings:
59 | CompileFlags:
60 | FrameworkDependencies:
61 | userData:
62 | assetBundleName:
63 | assetBundleVariant:
64 |
--------------------------------------------------------------------------------
/Realtime.Unity/Assets/Realtime/Plugins/libRealtimeWebGL.jslib:
--------------------------------------------------------------------------------
1 | var libraryRealtimeWebGL = {
2 |
3 | $webSocketInstances: [],
4 |
5 | SocketCreate: function(url)
6 | {
7 | var str = Pointer_stringify(url);
8 | var socket = {
9 | socket: new WebSocket(str),
10 | buffer: new Uint8Array(0),
11 | error: null,
12 | messages: []
13 | }
14 | socket.socket.onmessage = function (e) {
15 | var bytes = [];
16 | for (var i = 0; i < e.data.length; ++i) {
17 | bytes.push(e.data.charCodeAt(i));
18 | }
19 | socket.messages.push(bytes);
20 | };
21 | socket.socket.onclose = function (e) {
22 | if (e.code != 1000)
23 | {
24 | if (e.reason != null && e.reason.length > 0)
25 | socket.error = e.reason;
26 | else
27 | {
28 | switch (e.code)
29 | {
30 | case 1001:
31 | socket.error = "Endpoint going away.";
32 | break;
33 | case 1002:
34 | socket.error = "Protocol error.";
35 | break;
36 | case 1003:
37 | socket.error = "Unsupported message.";
38 | break;
39 | case 1005:
40 | socket.error = "No status.";
41 | break;
42 | case 1006:
43 | socket.error = "Abnormal disconnection.";
44 | break;
45 | case 1009:
46 | socket.error = "Data frame too large.";
47 | break;
48 | default:
49 | socket.error = "Error "+e.code;
50 | }
51 | }
52 | }
53 | }
54 | var instance = webSocketInstances.push(socket) - 1;
55 | return instance;
56 | },
57 |
58 | SocketState: function (socketInstance)
59 | {
60 | var socket = webSocketInstances[socketInstance];
61 | return socket.socket.readyState;
62 | },
63 |
64 | SocketError: function (socketInstance, ptr, bufsize)
65 | {
66 | var socket = webSocketInstances[socketInstance];
67 | if (socket.error == null)
68 | return 0;
69 | var str = socket.error.slice(0, Math.max(0, bufsize - 1));
70 | writeStringToMemory(str, ptr, false);
71 | return 1;
72 | },
73 |
74 | SocketSend: function (socketInstance, ptr, length)
75 | {
76 | var socket = webSocketInstances[socketInstance];
77 | socket.socket.send (HEAPU8.buffer.slice(ptr, ptr+length));
78 | },
79 |
80 | SocketRecvLength: function(socketInstance)
81 | {
82 | var socket = webSocketInstances[socketInstance];
83 | if (socket.messages.length == 0)
84 | return 0;
85 | return socket.messages[0].length;
86 | },
87 |
88 | SocketRecv: function (socketInstance, ptr, length)
89 | {
90 | var socket = webSocketInstances[socketInstance];
91 | if (socket.messages.length == 0)
92 | return 0;
93 | if (socket.messages[0].length > length)
94 | return 0;
95 | HEAPU8.set(socket.messages[0], ptr);
96 | socket.messages = socket.messages.slice(1);
97 | },
98 |
99 | SocketClose: function (socketInstance)
100 | {
101 | var socket = webSocketInstances[socketInstance];
102 | socket.socket.close();
103 | }
104 | };
105 |
106 | autoAddDeps(libraryRealtimeWebGL, '$webSocketInstances');
107 | mergeInto(LibraryManager.library, libraryRealtimeWebGL);
108 |
--------------------------------------------------------------------------------
/Realtime.Unity/Assets/Realtime/Plugins/libRealtimeWebGL.jslib.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 72d547aa366c6554fb8b967fee203501
3 | timeCreated: 1451185623
4 | licenseType: Free
5 | PluginImporter:
6 | serializedVersion: 1
7 | iconMap: {}
8 | executionOrder: {}
9 | isPreloaded: 0
10 | platformData:
11 | Any:
12 | enabled: 1
13 | settings: {}
14 | userData:
15 | assetBundleName:
16 | assetBundleVariant:
17 |
--------------------------------------------------------------------------------
/Realtime.Unity/Assets/Realtime/Plugins/websocket-sharp.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NVentimiglia/Realtime-Unity3d/2d71df4be661f00d721490ef23b7fb12677b698e/Realtime.Unity/Assets/Realtime/Plugins/websocket-sharp.dll
--------------------------------------------------------------------------------
/Realtime.Unity/Assets/Realtime/Plugins/websocket-sharp.dll.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: fab27f6f3517d470d9f19339ee67fc45
3 | PluginImporter:
4 | serializedVersion: 1
5 | iconMap: {}
6 | executionOrder: {}
7 | isPreloaded: 0
8 | platformData:
9 | Android:
10 | enabled: 1
11 | settings:
12 | CPU: AnyCPU
13 | Any:
14 | enabled: 0
15 | settings: {}
16 | BlackBerry:
17 | enabled: 1
18 | settings: {}
19 | Editor:
20 | enabled: 1
21 | settings:
22 | CPU: AnyCPU
23 | DefaultValueInitialized: true
24 | OS: AnyOS
25 | Linux:
26 | enabled: 1
27 | settings:
28 | CPU: x86
29 | Linux64:
30 | enabled: 1
31 | settings:
32 | CPU: x86_64
33 | LinuxUniversal:
34 | enabled: 1
35 | settings: {}
36 | OSXIntel:
37 | enabled: 1
38 | settings:
39 | CPU: AnyCPU
40 | OSXIntel64:
41 | enabled: 1
42 | settings:
43 | CPU: AnyCPU
44 | OSXUniversal:
45 | enabled: 1
46 | settings: {}
47 | Web:
48 | enabled: 1
49 | settings: {}
50 | WebStreamed:
51 | enabled: 1
52 | settings: {}
53 | Win:
54 | enabled: 1
55 | settings:
56 | CPU: AnyCPU
57 | Win64:
58 | enabled: 1
59 | settings:
60 | CPU: AnyCPU
61 | WindowsStoreApps:
62 | enabled: 0
63 | settings:
64 | CPU: AnyCPU
65 | iOS:
66 | enabled: 1
67 | settings:
68 | CompileFlags:
69 | FrameworkDependencies:
70 | userData:
71 | assetBundleName:
72 | assetBundleVariant:
73 |
--------------------------------------------------------------------------------
/Realtime.Unity/Assets/Realtime/Plugins/x86.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 381104318f4b3574eacca2d746140519
3 | folderAsset: yes
4 | timeCreated: 1451080757
5 | licenseType: Free
6 | DefaultImporter:
7 | userData:
8 | assetBundleName:
9 | assetBundleVariant:
10 |
--------------------------------------------------------------------------------
/Realtime.Unity/Assets/Realtime/Plugins/x86/libRealtimeDroid.so:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NVentimiglia/Realtime-Unity3d/2d71df4be661f00d721490ef23b7fb12677b698e/Realtime.Unity/Assets/Realtime/Plugins/x86/libRealtimeDroid.so
--------------------------------------------------------------------------------
/Realtime.Unity/Assets/Realtime/Plugins/x86/libRealtimeDroid.so.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 4f2329033252d6940aadbac5ac735800
3 | timeCreated: 1451080759
4 | licenseType: Free
5 | PluginImporter:
6 | serializedVersion: 1
7 | iconMap: {}
8 | executionOrder: {}
9 | isPreloaded: 0
10 | platformData:
11 | Android:
12 | enabled: 1
13 | settings:
14 | CPU: x86
15 | Any:
16 | enabled: 0
17 | settings: {}
18 | Editor:
19 | enabled: 0
20 | settings:
21 | CPU: x86
22 | DefaultValueInitialized: true
23 | OS: AnyOS
24 | Linux:
25 | enabled: 0
26 | settings:
27 | CPU: x86
28 | Linux64:
29 | enabled: 0
30 | settings:
31 | CPU: None
32 | LinuxUniversal:
33 | enabled: 0
34 | settings:
35 | CPU: None
36 | OSXIntel:
37 | enabled: 0
38 | settings:
39 | CPU: AnyCPU
40 | OSXIntel64:
41 | enabled: 0
42 | settings:
43 | CPU: None
44 | OSXUniversal:
45 | enabled: 0
46 | settings:
47 | CPU: None
48 | Win:
49 | enabled: 0
50 | settings:
51 | CPU: AnyCPU
52 | Win64:
53 | enabled: 0
54 | settings:
55 | CPU: None
56 | WindowsStoreApps:
57 | enabled: 0
58 | settings:
59 | CPU: AnyCPU
60 | DontProcess: False
61 | PlaceholderPath:
62 | SDK: AnySDK
63 | ScriptingBackend: AnyScriptingBackend
64 | iOS:
65 | enabled: 0
66 | settings:
67 | CompileFlags:
68 | FrameworkDependencies:
69 | userData:
70 | assetBundleName:
71 | assetBundleVariant:
72 |
--------------------------------------------------------------------------------
/Realtime.Unity/Assets/Realtime/README.txt:
--------------------------------------------------------------------------------
1 | Account Services : https://accounts.realtime.co/login/
2 | Source Code : https://github.com/NVentimiglia/Realtime-Unity3d-Plugin
3 | Readme & Wiki : https://github.com/NVentimiglia/Realtime-Unity3d-Plugin/wiki
--------------------------------------------------------------------------------
/Realtime.Unity/Assets/Realtime/README.txt.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 79bd3cb3fb54547439fb750a0cf3cc04
3 | timeCreated: 1451179494
4 | licenseType: Free
5 | TextScriptImporter:
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/Realtime.Unity/Assets/Realtime/Resources.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 57dd7c079e532f343b96c096ee521030
3 | folderAsset: yes
4 | timeCreated: 1454041251
5 | licenseType: Free
6 | DefaultImporter:
7 | userData:
8 | assetBundleName:
9 | assetBundleVariant:
10 |
--------------------------------------------------------------------------------
/Realtime.Unity/Assets/Realtime/Resources/README.txt:
--------------------------------------------------------------------------------
1 | Simple WebSockets for Unity WebGL
2 | =================================
3 |
4 | Description
5 | ===========
6 |
7 | This package implements basic support for the WebSocket networking protocol in Unity WebGL.
8 |
9 | For security reasons, direct access to IP Sockets is not available in JavaScript. However, it is possible to use the WebSockets protocol to implement networking in WebGL games. This package provides a JavaScript wrapper library which lets you use the browsers WebSockets JavaScript API from within Unity. For testing in the editor and running in other platforms, an implementation of the protocol using the websocket-sharp library is used.
10 |
11 | See the contained EchoTest.cs for a simple sample using a WebSocket connection to send and receive packages from an echo server.
12 |
13 | Disclaimer
14 | ==========
15 |
16 | This is an unsupported package provided by Unity Technologies for demonstration purposes.
17 |
18 | Manual
19 | ======
20 |
21 | WebSocket.WebSocket(Uri url)
22 |
23 | Creates a new WebSocket instance to connect to a specific Uri. The Uri should use the ws or wss uri protocol scheme.
24 |
25 |
26 |
27 |
28 | IEnumerator WebSocket.Connect()
29 |
30 | Coroutine to initiate a WebSocket connection. You can use this function like this to initiate a connection and wait for the connection result:
31 |
32 | yield return StartCoroutine(w.Connect());
33 |
34 |
35 |
36 | void WebSocket.Send(byte[] buffer)
37 | void WebSocket.SendString(string str)
38 |
39 | Send a package over a WebSocket connection. In the first form, the package is given as binary data in a byte array, in the second form it is supplied as a string.
40 |
41 |
42 |
43 |
44 | string WebSocket.RecvString()
45 | byte[] WebSocket.Recv()
46 |
47 | Checks if there are any pending received messages on the WebSocket connection. If yes, it will return the first message (as a string or byte array, depending on the function used), and remove it from the message queue. If there are no pending messages, it will return null.
48 |
49 |
50 |
51 | void WebSocket.Close()
52 |
53 | Closes the websocket connection.
54 |
55 |
56 |
57 | string WebSocket.error
58 |
59 | An error message if there were any errors in the last operation, null otherwise.
60 |
61 |
62 |
63 |
64 | Notes
65 | =====
66 |
67 | websocket-sharp.dll built from https://github.com/sta/websocket-sharp.git, commit 1a94864e86368453455a9c77e1defad6ecd0bd41.
68 |
69 | WebSocket-Sharp License:
70 | ========================
71 |
72 | The MIT License (MIT)
73 |
74 | Copyright (c) 2010-2015 sta.blockhead
75 |
76 | Permission is hereby granted, free of charge, to any person obtaining a copy
77 | of this software and associated documentation files (the "Software"), to deal
78 | in the Software without restriction, including without limitation the rights
79 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
80 | copies of the Software, and to permit persons to whom the Software is
81 | furnished to do so, subject to the following conditions:
82 |
83 | The above copyright notice and this permission notice shall be included in
84 | all copies or substantial portions of the Software.
85 |
86 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
87 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
88 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
89 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
90 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
91 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
92 | THE SOFTWARE.
--------------------------------------------------------------------------------
/Realtime.Unity/Assets/Realtime/Resources/README.txt.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 06f1a70955d9b45699a0a38bc11d64bb
3 | TextScriptImporter:
4 | userData:
5 | assetBundleName:
6 |
--------------------------------------------------------------------------------
/Realtime.Unity/Assets/Realtime/Resources/Realtime.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NVentimiglia/Realtime-Unity3d/2d71df4be661f00d721490ef23b7fb12677b698e/Realtime.Unity/Assets/Realtime/Resources/Realtime.png
--------------------------------------------------------------------------------
/Realtime.Unity/Assets/Realtime/Resources/Realtime.png.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 690652c2cf78c474fb2f15cc1390e4a1
3 | timeCreated: 1453439107
4 | licenseType: Free
5 | TextureImporter:
6 | fileIDToRecycleName: {}
7 | serializedVersion: 2
8 | mipmaps:
9 | mipMapMode: 0
10 | enableMipMap: 1
11 | linearTexture: 0
12 | correctGamma: 0
13 | fadeOut: 0
14 | borderMipMap: 0
15 | mipMapFadeDistanceStart: 1
16 | mipMapFadeDistanceEnd: 3
17 | bumpmap:
18 | convertToNormalMap: 0
19 | externalNormalMap: 0
20 | heightScale: 0.25
21 | normalMapFilter: 0
22 | isReadable: 0
23 | grayScaleToAlpha: 0
24 | generateCubemap: 0
25 | cubemapConvolution: 0
26 | cubemapConvolutionSteps: 7
27 | cubemapConvolutionExponent: 1.5
28 | seamlessCubemap: 0
29 | textureFormat: -1
30 | maxTextureSize: 2048
31 | textureSettings:
32 | filterMode: -1
33 | aniso: -1
34 | mipBias: -1
35 | wrapMode: -1
36 | nPOTScale: 1
37 | lightmap: 0
38 | rGBM: 0
39 | compressionQuality: 50
40 | allowsAlphaSplitting: 0
41 | spriteMode: 0
42 | spriteExtrude: 1
43 | spriteMeshType: 1
44 | alignment: 0
45 | spritePivot: {x: 0.5, y: 0.5}
46 | spriteBorder: {x: 0, y: 0, z: 0, w: 0}
47 | spritePixelsToUnits: 100
48 | alphaIsTransparency: 0
49 | textureType: -1
50 | buildTargetSettings: []
51 | spriteSheet:
52 | sprites: []
53 | outline: []
54 | spritePackingTag:
55 | userData:
56 | assetBundleName:
57 | assetBundleVariant:
58 |
--------------------------------------------------------------------------------
/Realtime.Unity/Assets/WSATestCertificate.pfx:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NVentimiglia/Realtime-Unity3d/2d71df4be661f00d721490ef23b7fb12677b698e/Realtime.Unity/Assets/WSATestCertificate.pfx
--------------------------------------------------------------------------------
/Realtime.Unity/Assets/WSATestCertificate.pfx.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: e94369c4624adf941b83e2fd6371525a
3 | timeCreated: 1427333878
4 | licenseType: Free
5 | DefaultImporter:
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/Realtime.Unity/Realtime.Unity-csharp.sln:
--------------------------------------------------------------------------------
1 | Microsoft Visual Studio Solution File, Format Version 11.00
2 | # Visual Studio 2008
3 |
4 | Project("{79C50BF9-D2CB-E93B-03BB-1C0239E9F3BC}") = "Realtime.Unity", "Assembly-CSharp-vs.csproj", "{6420D591-C6A1-7CCE-1604-82B3F06C4A43}"
5 | EndProject
6 | Project("{79C50BF9-D2CB-E93B-03BB-1C0239E9F3BC}") = "Realtime.Unity", "Assembly-CSharp-Editor-vs.csproj", "{E69B214A-1937-4D7C-61CF-C3CD96FE87A6}"
7 | EndProject
8 | Global
9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
10 | Debug|Any CPU = Debug|Any CPU
11 | Release|Any CPU = Release|Any CPU
12 | EndGlobalSection
13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
14 | {6420D591-C6A1-7CCE-1604-82B3F06C4A43}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15 | {6420D591-C6A1-7CCE-1604-82B3F06C4A43}.Debug|Any CPU.Build.0 = Debug|Any CPU
16 | {6420D591-C6A1-7CCE-1604-82B3F06C4A43}.Release|Any CPU.ActiveCfg = Release|Any CPU
17 | {6420D591-C6A1-7CCE-1604-82B3F06C4A43}.Release|Any CPU.Build.0 = Release|Any CPU
18 | {E69B214A-1937-4D7C-61CF-C3CD96FE87A6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
19 | {E69B214A-1937-4D7C-61CF-C3CD96FE87A6}.Debug|Any CPU.Build.0 = Debug|Any CPU
20 | {E69B214A-1937-4D7C-61CF-C3CD96FE87A6}.Release|Any CPU.ActiveCfg = Release|Any CPU
21 | {E69B214A-1937-4D7C-61CF-C3CD96FE87A6}.Release|Any CPU.Build.0 = Release|Any CPU
22 | EndGlobalSection
23 | GlobalSection(SolutionProperties) = preSolution
24 | HideSolutionNode = FALSE
25 | EndGlobalSection
26 | GlobalSection(MonoDevelopProperties) = preSolution
27 | StartupItem = Assembly-CSharp.csproj
28 | Policies = $0
29 | $0.TextStylePolicy = $1
30 | $1.inheritsSet = null
31 | $1.scope = text/x-csharp
32 | $0.CSharpFormattingPolicy = $2
33 | $2.inheritsSet = Mono
34 | $2.inheritsScope = text/x-csharp
35 | $2.scope = text/x-csharp
36 | $0.TextStylePolicy = $3
37 | $3.FileWidth = 120
38 | $3.TabWidth = 4
39 | $3.IndentWidth = 4
40 | $3.EolMarker = Unix
41 | $3.inheritsSet = Mono
42 | $3.inheritsScope = text/plain
43 | $3.scope = text/plain
44 | EndGlobalSection
45 |
46 | EndGlobal
47 |
--------------------------------------------------------------------------------
/Realtime.Unity/Realtime.Unity.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 2015
4 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Realtime.Unity.CSharp", "Realtime.Unity.CSharp.csproj", "{DB2101E3-1ED1-EFA6-B28A-DCC07C164D41}"
5 | EndProject
6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Realtime.Unity.CSharp.Editor", "Realtime.Unity.CSharp.Editor.csproj", "{583BCDE3-C42D-F8C5-B013-2AB52D77186F}"
7 | EndProject
8 | Global
9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
10 | Debug|Any CPU = Debug|Any CPU
11 | Release|Any CPU = Release|Any CPU
12 | EndGlobalSection
13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
14 | {DB2101E3-1ED1-EFA6-B28A-DCC07C164D41}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15 | {DB2101E3-1ED1-EFA6-B28A-DCC07C164D41}.Debug|Any CPU.Build.0 = Debug|Any CPU
16 | {DB2101E3-1ED1-EFA6-B28A-DCC07C164D41}.Release|Any CPU.ActiveCfg = Release|Any CPU
17 | {DB2101E3-1ED1-EFA6-B28A-DCC07C164D41}.Release|Any CPU.Build.0 = Release|Any CPU
18 | {583BCDE3-C42D-F8C5-B013-2AB52D77186F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
19 | {583BCDE3-C42D-F8C5-B013-2AB52D77186F}.Debug|Any CPU.Build.0 = Debug|Any CPU
20 | {583BCDE3-C42D-F8C5-B013-2AB52D77186F}.Release|Any CPU.ActiveCfg = Release|Any CPU
21 | {583BCDE3-C42D-F8C5-B013-2AB52D77186F}.Release|Any CPU.Build.0 = Release|Any CPU
22 | EndGlobalSection
23 | GlobalSection(SolutionProperties) = preSolution
24 | HideSolutionNode = FALSE
25 | EndGlobalSection
26 | EndGlobal
27 |
--------------------------------------------------------------------------------
/Realtime.Unity/UnityVS.Realtime.Unity.CSharp.Editor.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Debug
5 | AnyCPU
6 | 10.0.20506
7 | 2.0
8 | {59E58D56-8B77-7726-0C03-766AC6B2F1D7}
9 | Library
10 | Assembly-CSharp-Editor
11 | 512
12 | {E097FAD1-6243-4DAD-9C02-E9B9EFC3FFC1};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
13 | .NETFramework
14 | v3.5
15 | Unity Full v3.5
16 |
17 | Editor:5
18 | StandaloneWindows:5
19 | 4.7.0f1
20 |
21 |
22 |
23 | pdbonly
24 | false
25 | Temp\UnityVS_bin\Debug\
26 | Temp\UnityVS_obj\Debug\
27 | prompt
28 | 4
29 | DEBUG;TRACE;UNITY_4_7_0;UNITY_4_7;UNITY_STANDALONE_WIN;ENABLE_MICROPHONE;ENABLE_TEXTUREID_MAP;ENABLE_UNITYEVENTS;ENABLE_NEW_HIERARCHY ;ENABLE_AUDIO_FMOD;UNITY_STANDALONE;ENABLE_TERRAIN;ENABLE_SUBSTANCE;ENABLE_GENERICS;INCLUDE_IL2CPP;INCLUDE_WP8SUPPORT;ENABLE_MOVIES;ENABLE_WWW;ENABLE_IMAGEEFFECTS;ENABLE_4_6_FEATURES;INCLUDE_WP_BLUE_SUPPORT;ENABLE_WEBCAM;INCLUDE_METROSUPPORT;RENDER_SOFTWARE_CURSOR;ENABLE_NETWORK;ENABLE_PHYSICS;UNITY5_SCRIPTING_IN_UNITY4;ENABLE_CACHING;ENABLE_CLOTH;ENABLE_2D_PHYSICS;ENABLE_SHADOWS;ENABLE_AUDIO;ENABLE_NAVMESH_CARVING;ENABLE_DUCK_TYPING;ENABLE_SINGLE_INSTANCE_BUILD_SETTING;ENABLE_MONO;ENABLE_PROFILER;UNITY_EDITOR;UNITY_EDITOR_WIN
30 | false
31 |
32 |
33 | pdbonly
34 | false
35 | Temp\UnityVS_bin\Release\
36 | Temp\UnityVS_obj\Release\
37 | prompt
38 | 4
39 | TRACE;UNITY_4_7_0;UNITY_4_7;UNITY_STANDALONE_WIN;ENABLE_MICROPHONE;ENABLE_TEXTUREID_MAP;ENABLE_UNITYEVENTS;ENABLE_NEW_HIERARCHY ;ENABLE_AUDIO_FMOD;UNITY_STANDALONE;ENABLE_TERRAIN;ENABLE_SUBSTANCE;ENABLE_GENERICS;INCLUDE_IL2CPP;INCLUDE_WP8SUPPORT;ENABLE_MOVIES;ENABLE_WWW;ENABLE_IMAGEEFFECTS;ENABLE_4_6_FEATURES;INCLUDE_WP_BLUE_SUPPORT;ENABLE_WEBCAM;INCLUDE_METROSUPPORT;RENDER_SOFTWARE_CURSOR;ENABLE_NETWORK;ENABLE_PHYSICS;UNITY5_SCRIPTING_IN_UNITY4;ENABLE_CACHING;ENABLE_CLOTH;ENABLE_2D_PHYSICS;ENABLE_SHADOWS;ENABLE_AUDIO;ENABLE_NAVMESH_CARVING;ENABLE_DUCK_TYPING;ENABLE_SINGLE_INSTANCE_BUILD_SETTING;ENABLE_MONO;ENABLE_PROFILER;UNITY_EDITOR;UNITY_EDITOR_WIN
40 | false
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 | Library\UnityAssemblies\UnityEngine.dll
53 |
54 |
55 | Library\UnityAssemblies\UnityEditor.dll
56 |
57 |
58 | Library\UnityAssemblies\UnityEngine.UI.dll
59 |
60 |
61 | Library\UnityAssemblies\UnityEditor.UI.dll
62 |
63 |
64 | Library\UnityAssemblies\UnityEditor.Graphs.dll
65 |
66 |
67 | Assets\AssetStoreTools\Editor\AssetStoreTools.dll
68 |
69 |
70 | Assets\AssetStoreTools\Editor\AssetStoreToolsExtra.dll
71 |
72 |
73 | Assets\Realtime\Plugins\Realtime.Ortc.Api.dll
74 |
75 |
76 | Assets\Realtime\Plugins\websocket-sharp.dll
77 |
78 |
79 | Assets\UnityVS\Editor\SyntaxTree.VisualStudio.Unity.Bridge.dll
80 |
81 |
82 | Assets\UnityVS\Editor\SyntaxTree.VisualStudio.Unity.Messaging.dll
83 |
84 |
85 | Assets\UnityVS\Editor\UnityVS.VersionSpecific.dll
86 |
87 |
88 |
89 |
90 | {9F537266-62A8-D557-CE75-513DC75C101B}
91 | UnityVS.Realtime.Unity.CSharp
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
--------------------------------------------------------------------------------
/Realtime.Unity/UnityVS.Realtime.Unity.CSharp.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Debug
5 | AnyCPU
6 | 10.0.20506
7 | 2.0
8 | {9F537266-62A8-D557-CE75-513DC75C101B}
9 | Library
10 | Assembly-CSharp
11 | 512
12 | {E097FAD1-6243-4DAD-9C02-E9B9EFC3FFC1};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
13 | .NETFramework
14 | v3.5
15 | Unity Subset v3.5
16 |
17 | Game:1
18 | StandaloneWindows:5
19 | 4.7.0f1
20 |
21 |
22 |
23 | pdbonly
24 | false
25 | Temp\UnityVS_bin\Debug\
26 | Temp\UnityVS_obj\Debug\
27 | prompt
28 | 4
29 | DEBUG;TRACE;UNITY_4_7_0;UNITY_4_7;UNITY_STANDALONE_WIN;ENABLE_MICROPHONE;ENABLE_TEXTUREID_MAP;ENABLE_UNITYEVENTS;ENABLE_NEW_HIERARCHY ;ENABLE_AUDIO_FMOD;UNITY_STANDALONE;ENABLE_TERRAIN;ENABLE_SUBSTANCE;ENABLE_GENERICS;INCLUDE_IL2CPP;INCLUDE_WP8SUPPORT;ENABLE_MOVIES;ENABLE_WWW;ENABLE_IMAGEEFFECTS;ENABLE_4_6_FEATURES;INCLUDE_WP_BLUE_SUPPORT;ENABLE_WEBCAM;INCLUDE_METROSUPPORT;RENDER_SOFTWARE_CURSOR;ENABLE_NETWORK;ENABLE_PHYSICS;UNITY5_SCRIPTING_IN_UNITY4;ENABLE_CACHING;ENABLE_CLOTH;ENABLE_2D_PHYSICS;ENABLE_SHADOWS;ENABLE_AUDIO;ENABLE_NAVMESH_CARVING;ENABLE_DUCK_TYPING;ENABLE_SINGLE_INSTANCE_BUILD_SETTING;ENABLE_MONO;ENABLE_PROFILER;UNITY_EDITOR;UNITY_EDITOR_WIN
30 | false
31 |
32 |
33 | pdbonly
34 | false
35 | Temp\UnityVS_bin\Release\
36 | Temp\UnityVS_obj\Release\
37 | prompt
38 | 4
39 | TRACE;UNITY_4_7_0;UNITY_4_7;UNITY_STANDALONE_WIN;ENABLE_MICROPHONE;ENABLE_TEXTUREID_MAP;ENABLE_UNITYEVENTS;ENABLE_NEW_HIERARCHY ;ENABLE_AUDIO_FMOD;UNITY_STANDALONE;ENABLE_TERRAIN;ENABLE_SUBSTANCE;ENABLE_GENERICS;INCLUDE_IL2CPP;INCLUDE_WP8SUPPORT;ENABLE_MOVIES;ENABLE_WWW;ENABLE_IMAGEEFFECTS;ENABLE_4_6_FEATURES;INCLUDE_WP_BLUE_SUPPORT;ENABLE_WEBCAM;INCLUDE_METROSUPPORT;RENDER_SOFTWARE_CURSOR;ENABLE_NETWORK;ENABLE_PHYSICS;UNITY5_SCRIPTING_IN_UNITY4;ENABLE_CACHING;ENABLE_CLOTH;ENABLE_2D_PHYSICS;ENABLE_SHADOWS;ENABLE_AUDIO;ENABLE_NAVMESH_CARVING;ENABLE_DUCK_TYPING;ENABLE_SINGLE_INSTANCE_BUILD_SETTING;ENABLE_MONO;ENABLE_PROFILER;UNITY_EDITOR;UNITY_EDITOR_WIN
40 | false
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 | Library\UnityAssemblies\UnityEditor.dll
53 |
54 |
55 | Library\UnityAssemblies\UnityEngine.dll
56 |
57 |
58 | Library\UnityAssemblies\UnityEngine.UI.dll
59 |
60 |
61 | Assets\Realtime\Plugins\Realtime.Ortc.Api.dll
62 |
63 |
64 | Assets\Realtime\Plugins\websocket-sharp.dll
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
--------------------------------------------------------------------------------
/Realtime.Unity/UnityVS.Realtime.Unity.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 2015
4 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UnityVS.Realtime.Unity.CSharp", "UnityVS.Realtime.Unity.CSharp.csproj", "{9F537266-62A8-D557-CE75-513DC75C101B}"
5 | EndProject
6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UnityVS.Realtime.Unity.CSharp.Editor", "UnityVS.Realtime.Unity.CSharp.Editor.csproj", "{59E58D56-8B77-7726-0C03-766AC6B2F1D7}"
7 | EndProject
8 | Global
9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
10 | Debug|Any CPU = Debug|Any CPU
11 | Release|Any CPU = Release|Any CPU
12 | EndGlobalSection
13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
14 | {9F537266-62A8-D557-CE75-513DC75C101B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15 | {9F537266-62A8-D557-CE75-513DC75C101B}.Debug|Any CPU.Build.0 = Debug|Any CPU
16 | {9F537266-62A8-D557-CE75-513DC75C101B}.Release|Any CPU.ActiveCfg = Release|Any CPU
17 | {9F537266-62A8-D557-CE75-513DC75C101B}.Release|Any CPU.Build.0 = Release|Any CPU
18 | {59E58D56-8B77-7726-0C03-766AC6B2F1D7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
19 | {59E58D56-8B77-7726-0C03-766AC6B2F1D7}.Debug|Any CPU.Build.0 = Debug|Any CPU
20 | {59E58D56-8B77-7726-0C03-766AC6B2F1D7}.Release|Any CPU.ActiveCfg = Release|Any CPU
21 | {59E58D56-8B77-7726-0C03-766AC6B2F1D7}.Release|Any CPU.Build.0 = Release|Any CPU
22 | EndGlobalSection
23 | GlobalSection(SolutionProperties) = preSolution
24 | HideSolutionNode = FALSE
25 | EndGlobalSection
26 | EndGlobal
27 |
--------------------------------------------------------------------------------
/Realtime.Unity/dfsdfsdf.apk:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NVentimiglia/Realtime-Unity3d/2d71df4be661f00d721490ef23b7fb12677b698e/Realtime.Unity/dfsdfsdf.apk
--------------------------------------------------------------------------------
/RealtimeForUnity.unitypackage:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NVentimiglia/Realtime-Unity3d/2d71df4be661f00d721490ef23b7fb12677b698e/RealtimeForUnity.unitypackage
--------------------------------------------------------------------------------
/libs/UnityEngine.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NVentimiglia/Realtime-Unity3d/2d71df4be661f00d721490ef23b7fb12677b698e/libs/UnityEngine.dll
--------------------------------------------------------------------------------