About the socket connection used by Metamask Unity SDK

Is there any documentation that explains in detail about the following URL defined in the MetaMaskWallet class?

/// <summary>The URL of the MetaMask app.</summary>
public const string MetaMaskAppLinkUrl = "https://metamask.app.link";

/// <summary>The URL of the socket.io server.</summary>
public const string SocketUrl = "https://socket.codefi.network";

Also, for SocketUrl, I confirmed that the following URL is overwritten in config.
https://metamask-sdk-socket.metafi.codefi.network/

We are not sure if these two URLs are MetaMask services or not, and we do not know how they are processed internally,
I am at a loss to determine if I should continue to use them.

As for MetaMaskAppLinkUrl, I understand that it is a service for creating Deeplink as described in the following document
https://c0f4f41c-2f55-4863-921b-sdk-docs.github.io/guide/mobile-best-practices.html#deeplinking

Because when I read the program, it generates a QR code to access the following,
I would like to know what is being done on the mobile MetaMask app.
https://metamask.app.link/connect

Hey!

It looks like this was asked in our Discord a few days ago and there was a response. I will copy the response in here for anyone who sees this message.

"So those URLs are required for the socket io communication layer, essentially they provide the base URLs that are overridden and the transaction data is sent too over a bi directional channel:)

I don’t believe there is docs on this currently although it may be something doable in the future!"

Thanks for getting back to me.

I heard that the Discord is being shut down so I asked here as well. If anyone else knows more about this, I’d appreciate the information.

I was looking at the community here and I think I can find out what is being handled regarding MetaMaskAppLinkUrl by checking the following repository.
https://github.com/MetaMask/metamask-deeplinks

Please let me know about the following services that are set up for SocketUrl as well, if anyone has any references or knows what they are doing.
https://metamask-sdk-socket.metafi.codefi.network/

It has been moved over to the MetaMask channels within the ConsenSys Discord :slight_smile:

1 Like

Hi @tell196p ,

The team is updating examples. This should get published soon (expecting this week) and help!

2 Likes

So MetaMaskAppLinkUrl is the universal link domain used by QRCodes and universal links in general. So this is fundamental for establishing the connection between the Unity application (on desktop and mobile) and the MetaMask mobile app, making sure that the MetaMask mobile app is installed. Universal links like that have the advantage that check if the MM mobile app is installed, if it’s not, the user is taken to the app store to download it.

The SocketUrl instead is the URL of the Socket[dot]io server that used as a communication layer between the Unity application and the MetaMask mobile app. Please use https://metamask-sdk-socket.metafi.codefi.network/ as https://socket.codefi.network is an old URL that only redirect to the new one.

I hope this clarifies everything :wink:

2 Likes

Thanks for getting back to me.

I am not sure how MMApp is accessing the following URL.
https://metamask-sdk-socket.metafi.codefi.network/

Also,
whether accessing https://metamask.app.link or https://metamask-sdk-socket.metafi.codefi.network/ is secure and whether I can build these servers myself, I am most curious.

Hopefully these will be clarified this week :smile:

So this URL is the URL of the Socket server that we’ve built to support all the SDK communication. It is secured as there’s an ECIES encryption layer on top of it.

You can develop your own, but then you can also develop your own version of the MM Mobile app as this URL is “hard” coded in the SDK Communication Layer code that is used by both the SDK and the MM Mobile app.

Here’s the code of the SDK Communication Layer:
https://github.com/MetaMask/metamask-sdk/tree/main/packages/sdk-communication-layer

Here’s the code of the Socket Io server used:
https://github.com/MetaMask/metamask-sdk/tree/main/packages/sdk-socket-server

And here are all the info about how the communication work:
https://docs.metamask.io/wallet/concepts/sdk-connections/#communication-layer

For any questions about the MetaMask SDK, I’d suggest you use the JS SDK repo here for a timely reply:
https://github.com/MetaMask/metamask-sdk/issues

Cheers, Andrea

3 Likes

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.