watson-developer-cloud / unity-sdk

:video_game: Unity SDK to use the IBM Watson services.
Apache License 2.0
571 stars 208 forks source link

Investigate if we can use custom endpoints when deploying to Android or iOS #260

Closed germanattanasio closed 6 years ago

germanattanasio commented 6 years ago

Context

In the future, we may want to have custom endpoints for different targets. This issue is to investigate how flexible is unity and if we can address the items described below.

Acceptance Criteria

mediumTaj commented 6 years ago

In the latest SDK you would use platform specific compilation.

private SpeechToText _speechToText;
private Credentials _defaultCredentials = new Credentials(username, password, url);
private Credentials _mobileCredentials = new Credentials(mobileUsername, mobilePassword, mobileUrl);

#if UNITY_IOS || UNITY_ANDROID
    _speechToText = new SpeechToText(_mobileCredentials);
#else
    _speechToText = new SpeechToText(_defaultCredentials);
#endif

We can add some Editor code to detect what build platform the user has set and print to the console

void Start()
    {
        if (Application.platform == RuntimePlatform.IPhonePlayer  || 
            Application.platform == RuntimePlatform.Android)
                Debug.Log("Use mobile credentials!");
    }
mediumTaj commented 6 years ago

From jstylos

The goal would be to make it so all users had to do was update the Watson Unity SDK and then the app works even if the main endpoint shuts down TLS 1.0 support

mediumTaj commented 6 years ago

@germanattanasio @jsstylos Dan Cox and team got back to me with gateway-tls10.watsonplatform.net and stream-tls10.watsonplatform.net for TLS 1.0 only endpoints. They should be just another route in via datapower. They won't be creating a gateway-a-tls10 because they don't have ip address space and

I believe that AlchemyLanguage will be EOL'd by the end of March and that Visual Recognition will transfer over to SL only in 1Q. Based on this I would not expect gateway-a to have a -tls10 variant. There is some possibility gateway-a will be changed to point to PPRD datapower - but that will be covered by gateway-tls10.

We won't be able to hit Visual Recognition on a TLS 1.0 only endpoint until they move over in q1.

They opened up an issue here.

Thoughts?

jsstylos commented 6 years ago

Conversation and the Speech services should be first priority, not supporting gateway-a should hopefully be ok based on usage numbers.

mediumTaj commented 6 years ago

from dan

gateway-a.watsonplatform.net will continue to support tls 1.0 until it is shutdown.

We should be able to keep VR and Alchemy endpoints the same.

jsstylos commented 6 years ago

Great, even better.

mediumTaj commented 6 years ago

Public endpoints for gateway and stream for TLS 1.0 and 1.2 are now working

https://gateway-tls10.watsonplatform.net/
https://gateway-tls12.watsonplatform.net/

https://stream-tls10.watsonplatform.net/
https://stream-tls12.watsonplatform.net/
mediumTaj commented 6 years ago

I sent a sample application with buttons testing testing responses hitting these endpoints without the SDK to the Unity platform engineers. Waiting on them to test the application across all platforms before deciding what platforms to switch endpoints for.

mediumTaj commented 6 years ago

Unity responded with the results of the sample application. All build platforms work with both TLS 1.0 and TLS 1.2 endpoints. I built and tested for ios and android to verify and calls to gateway and stream are working.