データセンターの構成
最寄りのデータセンターに接続するために Client SDK を設定する必要があるかもしれません。このガイドを使用して、最適な設定を決定することができます。
注: これは高度なオプション・ステップです。ネットワーク・パフォーマンスを向上させる必要があると判断した場合のみ、この設定を行う必要があります。ほとんどのユーザーにとって、この設定は必要ありません。このステップは アプリケーションにSDKを追加する.
データセンターを構成する理由
よりローカルなデータセンターに接続することで、アプリケーションのパフォーマンスが向上すると考えられる場合のみ、この操作を行う必要があります。デフォルトでは、Client SDKは米国のデータセンターに接続します。
リージョン
Client SDK コンフィグにはイニシャライザーがあり、リージョン列挙型 (US, EU, AP):
を搭載した場合 <script> タグを付けている:
const client = new vonageClientSDK.VonageClient({
region: "EU"
});
を介してロードされた場合 import:
import { VonageClient } from "@vonage/client-sdk";
const client = new VonageClient({
region: "EU"
});
初期化後に更新する:
client.setConfig({
region: "AP"
});
val config = VGClientConfig(ClientConfigRegion.US) // Other options are .AP & .EU
val client = VonageClient(this.application.applicationContext)
client.setConfig(config)
let config = VGClientConfig(region: .US) // Other options are .AP & .EU
let client = VGVonageClient()
client.setConfig(config)
注: ClientSDKのデータセンターを変更する場合は、同じデータセンターにユーザーを作成する必要があります。データセンターのURLは以下の通りです。
URL
リージョンの設定以上にコントロールしたい場合は、以下のURLを設定することができる:
apiUrlConversation API URL。websocketUrlウェブソケットのURL。
apiUrl
Conversation API URLです。Client SDKがAPIを呼び出すときに使用するURLです。
デフォルト値は https://api-us-3.vonage.com.
| データセンター | URL |
|---|---|
Virginia | https://api-us-3.vonage.com |
Oregon | https://api-us-4.vonage.com |
Dublin | https://api-eu-3.vonage.com |
Frankfurt | https://api-eu-4.vonage.com |
Singapore | https://api-ap-3.vonage.com |
Sydney | https://api-ap-4.vonage.com |
websocketUrl
これはウェブソケットのURLで、リアルタイムイベントを受信するURLです。
デフォルト値は wss://ws-us-3.vonage.com.
| データセンター | URL |
|---|---|
Virginia | wss://ws-us-3.vonage.com |
Oregon | wss://ws-us-4.vonage.com |
Dublin | wss://ws-eu-3.vonage.com |
Frankfurt | wss://ws-eu-4.vonage.com |
Singapore | wss://ws-ap-3.vonage.com |
Sydney | wss://ws-ap-4.vonage.com |
URLによる設定
Client SDK を作成する際に、お好みの URL を指定することができます。 ClientConfig オブジェクトがある:
を搭載した場合 <script> タグを付けている:
const client = new vonageClientSDK.VonageClient({
apiUrl: "https://api-us-3.vonage.com",
websocketUrl: "wss://ws-us-3.vonage.com"
});
を介してロードされた場合 import:
import { VonageClient } from "@vonage/client-sdk";
const client = new VonageClient({
apiUrl: "https://api-us-3.vonage.com",
websocketUrl: "wss://ws-us-3.vonage.com"
});
初期化後に更新する:
client.setConfig({
apiUrl: "https://api-ap-3.vonage.com",
websocketUrl: "wss://ws-ap-3.vonage.com"
});
val config = VGClientConfig()
config.apiUrl = "https://api-us-3.vonage.com"
config.websocketUrl = "wss://ws-us-3.vonage.com"
val client = VonageClient(this.application.applicationContext)
client.setConfig(config)
let config = VGClientConfig()
config.apiUrl = "https://api-us-3.vonage.com"
config.websocketUrl = "wss://ws-us-3.vonage.com"
let client = VGVonageClient()
client.setConfig(config)