Websocket connection not working in manifestVersion 5

Hi, I’m having issues with running a websocket server connection with manifest version 5. I’m not getting any error logs. When I switch back to version 4 everything is working correctly. I couldn’t find any info on what changes with version 5 that could cause my problem.

here is my index.js:

async function connectToPythonWebSocket() {
  const ws = new WebSocket("ws://127.0.0.1:9000");

  ws.addEventListener("open", () => {
    console.log("Connected to Python WebSocket server");
  });

  ws.addEventListener("message", (event) => {
    console.log("Received data:", event.data);
    const data = JSON.parse(event.data);

    processFolderData(data.folder_count, data.folder_names).then(() => {
      //   console.log("Data processed");
    });
  });
  ws.addEventListener("error", (error) => {
    console.error("WebSocket error:", error);
  });
}
connectToPythonWebSocket();


function processFolderData(folder_count, folder_names) {
  return new Promise((resolve) => {
//..some code..
    const folderDataReceivedEvent = new CustomEvent('folderDataReceived', {
      detail: {
        folder_count: folder_count,
        folder_names: filteredFolderNames
      }
    });
    document.dispatchEvent(folderDataReceivedEvent);
    resolve();
  });
}

my manifest.json:

{
  "id": "Test-s92ugg",
  "name": "broken plugin",
  "version": "1.0.0",
  "main": "index.html",
  "dependencies": {
    "@adobe/uxp": "^1.0.0",
    "ws": "^8.0.0"
  },
  "requiredPermissions": {
    "launchProcess": {
      "schemes": [
        "https",
        "mailto",
        "file"
      ],
      "extensions": [
        ".pdf"
      ]
    },
    "network": {
      "domains": [
        "https://cc-extensions.com"
      ]
    },
    "allowCodeGenerationFromStrings": true,
    "localFileSystem": "plugin",
    "clipboard": "read"
  },
  "pub_date": null,
  "host": [
    {
      "app": "PS",
      "minVersion": "24.4.1",
      "data": {
        "apiVersion": 2
      }
    }
  ],
  "manifestVersion": 5,
  "entrypoints": [
    {
      "type": "panel",
      "id": "vanilla"
    }
  ]
}

and package.json:

{
  "name": "te-asset-exporter",
  "version": "1.0.0",
  "description": "a plugin that processes images and saves them in folders",
  "author": "Adobe Inc",
  "license": "Apache-2.0",
  "dependencies": {
    "ws": "^8.13.0"
  }
}

Any information on that or ideas would be much appreciated!

try with the following edit to your manifest:

  "requiredPermissions": {
    "network": {
      "domains": ["https://cc-extensions.com", "localhost", "127.0.0.1"]
    }
  }

if it fails try the with “all” just for testing:

  "requiredPermissions": {
    "network": {
      "domains": "all"
    }
  }
1 Like

Woah nice, thanks Maher for the reply!

"domains": "all" works fine.

"domains": ["https://cc-extensions.com", "localhost", "127.0.0.1"]

but this does not. But you said “all” just for testing, so I guess that is not a permanent solution for me?

it will alert (and alarm) your clients.
if it’s an in-house plugin then no problem… but if you’re planning to publish it, maybe try to find the right permission.

1 Like

Ah, I see. It is only for in-house purposes so this is working just fine for me :slight_smile:

Thank you very much for the help Maher! :pray:

1 Like