Community Member•3/25/2024, 1:52:29 AM
Why should you do this with chrome?
The API key is used for programmatic connection to our server.
Community Member•3/25/2024, 2:05:10 AM
oooh Alright got it!
Community Member•3/25/2024, 2:05:25 AM
Im trying to understand it better sorry
Community Member•3/25/2024, 2:09:56 AM
No worries - if there are any question - just ask 😉
Here is also a link (which should be also on the Email you received) to our documentation:
https://github.com/HypeRate/DevDocs
Community Member•3/25/2024, 2:11:21 AM
Should I add the JSON message code and others in the Hyperatesockey.cs code?
Community Member•3/25/2024, 2:13:12 AM
it seem you are playing arround with our Unity Plugin?
Community Member•3/25/2024, 2:24:20 AM
Yes
Community Member•3/25/2024, 2:24:30 AM
I saw an error on the compiler of Unity
Community Member•3/25/2024, 2:24:37 AM
Assets\HypeRate\HypeRate Heart Rate SDK\hyperateSocket.cs(7,7): error CS0246: The type or namespace name 'Newtonsoft' could not be found (are you missing a using directive or an assembly reference?)
Community Member•3/25/2024, 2:24:55 AM
Seems like something wrong with this code "using Newtonsoft.Json.Linq;"
Community Member•3/25/2024, 2:25:02 AM
That Newtonsoft is not being found
Community Member•3/25/2024, 2:26:36 AM
Make sure you have the Newtonsoft json package installed as well:
On Unity go to Windows->Package Manager, once the Package Manager window opens, go to Add package from git URL, type com.unity.nuget.newtonsoft-json press Add and done.
Community Member•3/25/2024, 2:30:35 AM
Perfect this worked
Community Member•3/25/2024, 2:30:40 AM
But now im facing another problem
Community Member•3/25/2024, 2:31:09 AM
It first connected to the server then this issue came up then it disconnected immediately
"Error! Unable to connect to the remote server
UnityEngine.Debug:Log (object)
hyperateSocket/<>c:<Start>b__4_1 (string) (at Assets/HypeRate/HypeRate Heart Rate SDK/hyperateSocket.cs:34)
NativeWebSocket.WebSocket/<Connect>d__27:MoveNext () (at Assets/HypeRate/HypeRate Heart Rate SDK/WebSocket.cs:478)
UnityEngine.UnitySynchronizationContext:ExecuteTasks ()"
Community Member•3/25/2024, 2:31:36 AM
Something regarding the websocket I did plug my API Key for the websocket
Community Member•3/25/2024, 2:32:00 AM
Am I supposed to connect the API Key to the session code?
Community Member•3/25/2024, 2:32:54 AM
did you copy and pasted the API Key?
We had a hand full of users who stated that they have to manually enter the API Key - then it works.
Community Member•3/25/2024, 2:33:14 AM
Yes I copy pasted it
Community Member•3/25/2024, 2:33:20 AM
I will write it manually then
Community Member•3/25/2024, 2:33:35 AM
hopefully this will fix it!
Community Member•3/25/2024, 2:36:49 AM
Gave the error
Community Member•3/25/2024, 2:37:57 AM
*Same error
Community Member•3/25/2024, 2:38:36 AM
i found someone in our archive who had the same issue - he fixed it this way (not very precise but it worked)
*"Thank you for your help, i just found the issue. I messed up the installation of Newtonsoft.Json. I reinstalled it the right way now and everything is working fine!"*
Community Member•3/25/2024, 2:38:56 AM
Alright will do that rn
Community Member•3/25/2024, 2:40:18 AM
Same issue
Community Member•3/25/2024, 2:40:26 AM
<@376326955554832385> maybe you can remember this issue - you also had this end of last year - maybe you can help here a bit 😉
Community Member•3/25/2024, 2:41:36 AM
did you restart Unity?
Community Member•3/25/2024, 2:41:52 AM
Nope. I will try that now
Community Member•3/25/2024, 2:42:55 AM
Restarting Unity didnt work
Community Member•3/25/2024, 2:43:35 AM
You can not start unity again or this did not fix the issue?
Community Member•3/25/2024, 2:46:14 AM
This did not fix the issue
Community Member•3/25/2024, 2:47:50 AM
Also I asked chatGPT
One of the recommended solutions says
"1) Double-check the URL of the WebSocket server (wss://app.hyperate.io/socket/websocket?token= + websocketToken). Ensure that it's correct and points to the intended server.
1) Verify that the WebSocket server is configured to accept incoming connections from your Unity application. Check the server logs for any errors or indications of failed connection attempts."
Is there a way I can double check if the URL work or to verify the websocket server? Or its not possible for those two to have any issues?
Community Member•3/25/2024, 2:48:16 AM
Its my very first time working on this so Im really grateful for your patience with me
Community Member•3/25/2024, 2:50:26 AM
maybe you can pm me your name and Project title you used in the registration form for the API.
or also the API Key itself, that i can search for you in the Backend.
Community Member•3/25/2024, 2:55:38 AM
Will do
Community Member•3/25/2024, 3:25:11 AM
Update:
Was about to close Unity and received two additional errors. Dont know if they are related
Community Member•3/25/2024, 3:25:20 AM
Community Member•3/25/2024, 3:26:08 AM
<@174193097285173250> maybe you have an idea and can help here <a:HypeRate_Love:876086555922558978>
Community Member•3/25/2024, 3:27:00 AM
Trying to Connect to API key with Unity
Community Member•3/25/2024, 6:56:46 AM
"NullReferenceExceptions" in most cases mean, that an object was referenced in your code that no longer exist (null). In both lines the error occurs for you, the code tries to access the "websocket" object to call a function. If the object doesn't exist, the function also doesn't exist and the error is thrown.
Did you maybe alter something in the code itself to cause a premature destruction of the websocket object?
Community Member•3/25/2024, 10:35:45 AM
I dont recall touching the websocket code.
I will try to re-download the asset again and then try using it once I have time as I am busy at the moment