Skip to content

Commit

Permalink
chore: update url for ios
Browse files Browse the repository at this point in the history
  • Loading branch information
maliroteh-sf committed May 22, 2024
1 parent f423bf0 commit 6a44b00
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
7 changes: 3 additions & 4 deletions src/common/PreviewUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
* SPDX-License-Identifier: MIT
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
*/
import os from 'node:os';
import path from 'node:path';
import { createRequire } from 'node:module';
import Ajv from 'ajv';
Expand Down Expand Up @@ -145,13 +144,13 @@ export class PreviewUtils {
- For desktop browsers other than Safari, local development use cases will target ws://localhost:<port> connections to the local dev server
- For the Safari desktop browser, target wss://localhost:<port>
- For mobile (Salesforce App), local development use cases will target:
- iOS: wss://<local hostname>:<port>
- For mobile (webview in native apps), local development use cases will target:
- iOS: wss://localhost:<port>
- Android: wss://10.0.2.2:<port>
*/

if (CommandLineUtils.platformFlagIsIOS(platform)) {
return `wss://${os.hostname()}:${port}`;
return `wss://localhost:${port}`;
}

if (CommandLineUtils.platformFlagIsAndroid(platform)) {
Expand Down
5 changes: 1 addition & 4 deletions test/unit/common/PreviewUtils.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
* SPDX-License-Identifier: MIT
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
*/
import os from 'node:os';
import path from 'node:path';
import { fileURLToPath } from 'node:url';
import { TestContext } from '@salesforce/core/testSetup';
Expand Down Expand Up @@ -187,9 +186,7 @@ describe('Preview utils tests', () => {

it('Generates correct websocket url', async () => {
// ensure that for iOS the proper url is generated
expect(PreviewUtils.generateWebSocketUrlForLocalDevServer('ios', '1234')).to.be.equal(
`wss://${os.hostname()}:1234`
);
expect(PreviewUtils.generateWebSocketUrlForLocalDevServer('ios', '1234')).to.be.equal('wss://localhost:1234');

// ensure that for Android the proper url is generated
expect(PreviewUtils.generateWebSocketUrlForLocalDevServer('android', '1234')).to.be.equal(
Expand Down

0 comments on commit 6a44b00

Please sign in to comment.