I cant seem to figure out a working solution to this error, more complete:
018-06-01 10:33:09 PM [Error] WebSocket: ws_0 - could not connect System.Net.Sockets.SocketException (0x80004005): No route to host
2018-06-01 10:33:09 PM [Error] WebSocket: ws_0 - WebSocketException during handshake Firebase.Database.Internal.TubeSock.WebSocketException: unknown host: ########.firebaseio.com ---> System.Net.Sockets.SocketException: No route to host
Take note, the above errors repeat a few times every second, with ws_# incrementing by one each time
Unity 2018.1.1f1
Firebase-Database: Whatever is newest, got a few days ago
Bit of code:
void Start() {
FirebaseApp.LogLevel = LogLevel.Verbose;
FirebaseDatabase.DefaultInstance.LogLevel = LogLevel.Verbose; // Or your database instance, if not using the default.
FirebaseApp.CheckAndFixDependenciesAsync().ContinueWith(task => {
var dependencyStatus = task.Result;
if (dependencyStatus == Firebase.DependencyStatus.Available) {
FirebaseApp app = FirebaseApp.DefaultInstance;
// NOTE: You'll need to replace this url with your Firebase App's database
// path in order for the database connection to work correctly in editor.
app.SetEditorDatabaseUrl("https://########.firebaseio.com/");
if (app.Options.DatabaseUrl != null) app.SetEditorDatabaseUrl(app.Options.DatabaseUrl);
} else {
Debug.LogError(System.String.Format(
"Could not resolve all Firebase dependencies: {0}", dependencyStatus));
// Firebase Unity SDK is not safe to use here.
}
});
}
Below is my attempt to access the firebase database
DatabaseReference mDatabaseRef = FirebaseDatabase.DefaultInstance.RootReference;
staticLocalData.thisUser = new UserData();
staticLocalData.thisUser.userID = newUser.UserId;
staticLocalData.thisUser.email = email;
staticLocalData.thisUser.firstName = firstName;
staticLocalData.thisUser.lastName = lastName;
registerData temp = new registerData();
temp.firstName = firstName;
temp.lastName = lastName;
temp.email = email;
temp.userName = userName;
Debug.Log(JsonUtility.ToJson(temp));
mDatabaseRef.Child("users").SetValueAsync("saddsa:23");
//mDatabaseRef.Child("users").Child(newUser.UserId).SetRawJsonValueAsync(JsonUtility.ToJson(temp));
Ruleset: (Should allow for all)
{
"rules": {
".read": true,
".write": true
}
}
Additional notes:
Using:
Unity Editor 2018.2.5f1 on OSX Sierra 10.12.6
scripting Runtime 4.x
scripting backend IL2CPP
API Level 4.x
Firebase plugin version 5.2.1
This exact same problem was happening. This seemed to be related to the Mono Websocket implementations, as discussed in more detail on the following issues:
https://github.com/firebase/quickstart-unity/issues/106
https://github.com/firebase/quickstart-unity/issues/162
The Firebase dev team went around what is described there by providing their own native websocket implementations for each platform. Apparently the Unity Editor implementation is lagging behind.
The way to workaround this issue here was by disabling the FirebaseDatabase.dll under ../Firebase/Plugins/Mono/ for the editor platform, and then enabling the one FirebaseDatabase.dll directly under ../Firebase/Plugins/ instead.
So far, so good.
It is fixed in new firebase_sdk_v6.2.1 July release
User contributions licensed under CC BY-SA 3.0