Sockets
Instructions
Follow the steps below to join a real-time chat using the example file above.
Using the default server
This example project requires a server to handle connections between connected prototypes, but we've set up a default server that you can use.
Visit this link to wake up the chat server
Open the Sockets.framerx project
Open a Live Preview
Click Open in Browser, open the preview on your mobile device, or send the link to a friend
Preview the Frame named Export to see it in action. Enjoy the conversation.
Starting a custom server
To create your own server, either for a more private chat or to experiment with the server's code:
- Visit the socket server on CodeSandbox
- Click Fork to create your own version of the sandbox
- When the project loads, copy the url shown under Listening for Connections to
- In the Sockets.framerx example project, open the
access.tsfile. - From your CodeSandbox preview, copy the URL shown under Listening for connections at to the variable
SERVER_URL.
The result should look something like this:
const SERVER_URL = "https://lskik.sse.codesandbox.io/"Learn more
The example file (and the server) use Socket.io to handle real-time communication.
To see more examples of using Framer X with sockets, check out the article Multiplayer Prototypes with Framer X.