yjs/y-webrtc

public signaling servers down?

Lukap22 opened this issue ยท 10 comments

Hallo,

My app cannot connect to ['wss://signaling.yjs.dev', 'wss://y-webrtc-signaling-eu.herokuapp.com', 'wss://y-webrtc-signaling-us.herokuapp.com']
image

A few weeks back this wasn't the case.

Code used:

import { WebrtcProvider } from "y-webrtc";
import { Doc } from "yjs";

const doc = new Doc();

export const webrtcProvider = new WebrtcProvider(
  "vZ#4h2%60$1H",
  doc,
  { password: "wMrg3@4WVf^q@iK6xukh@86&fCY5GmvX" }
);

export const disconnect = () => webrtcProvider.disconnect();
export const connect = () => webrtcProvider.connect();

// Get the provider's awareness API
export const awareness = webrtcProvider.awareness;

import { Avatar, Divider, Grid, Stack, Tooltip } from "@mui/material";
import ActionDialog from "@src/components/ActionDialog";
import { MIconButton } from "@src/components/minimals/@material-extend";
import useAuth, { User } from "@src/hooks/useAuth";
import { useEffect } from "react";
import { useTranslation } from "react-i18next";
import { useParams } from "react-router";
import { useUsers } from "y-presence";

export type YUser = User & { name: string, orderId: number | null };
export type UseUsers = Map<number, YUser>;
import { awareness } from "../syncedStores/orderSyncedStore";

export default function SyncedUsers({ order_id }: { order_id: number }) {
  const { t: dashboardT } = useTranslation("dashboard");
  const { user } = useAuth();
  const {id} = useParams()
  console.log("synced",{id})

  useEffect(() => {
    if (user && id) {
      const yUser: YUser = {
        name: `${user.first_name} ${user.last_name}`,
        ...user,
        orderId : Number(id),
      };
      awareness.setLocalState(yUser);
    }
  }, [id, user]);

  const users = useUsers(awareness) as UseUsers;
  const orderUsers = Array.from(users.entries()).filter(
    ([_, u]) => u.orderId !== order_id && u.id !== user?.id
  );
  
  return (
    <>
      <Stack gap={2} direction={"row"} ml={"auto"}>
        {orderUsers.map(([_, value]) => {
          return <YUserAvatar key={value.id} user={value} />;
        })}
      </Stack>
      {orderUsers.length >= 1 && (
        <ActionDialog title={dashboardT("warning")} open={true}>
          {dashboardT("there_are_other_users_in_this_order")}
        </ActionDialog>
      )}
    </>
  );
}

export function YUserAvatar({ user }: { user: YUser }) {
  const { t: commonT } = useTranslation("common");
  return (
    <ActionDialog
      title={`${user.name}`}
      openButton={(setOpen) => (
        <Tooltip title={user.name}>
          <MIconButton
            onClick={() => setOpen(true)}
            sx={{
              padding: 0,
              width: 44,
              height: 44,
            }}
          >
            <Avatar
              alt="User avatar"
              sx={{
                mx: "auto",
                bgcolor: "primary.main",
                color: "text.primary",
              }}
            >
              {user.first_name.slice(0, 1)}
              {user.last_name.slice(0, 1)}
            </Avatar>
          </MIconButton>
        </Tooltip>
      )}
    >
      <Grid container>
        <Grid item xs={3}>
          Email
        </Grid>
        <Grid item xs={9}>
          {user.email}
        </Grid>
        <Divider />
        <Grid item xs={3}>
          Rol
        </Grid>
        <Grid item xs={9}>
          {commonT(user.role)}
        </Grid>
        <Divider />
      </Grid>
    </ActionDialog>
  );
}

I would like to deploy my own signaling server but find the tuturial to be unclear. Could anyone help me with this?

The demo here isn't working https://docs.yjs.dev/getting-started/a-collaborative-editor

Why the wontfix tag?

The demo here isn't working https://docs.yjs.dev/getting-started/a-collaborative-editor

Why the wontfix tag?

I accidentally added it and I can't seem to remove it. But the demo is working on the website on the website, right? On stackblitz I get errors though.

I get the same errors.. Probably some heroku foo ๐Ÿฅฒ

laem commented

Yes, all 3 default servers are down for me too.

image

Also bitten by this. Time to set up independent servers it seems..

Hey! We also have a problem with that - it's not critical for us as we've used that only for some local development and we are in the middle of migrating to private signaling server. But I guess could be nice to resolve if feasible ๐Ÿ˜„

As for having a private signaling server, there is an example server in ./bin folder, which works fine and I think can be used out of the box.

Thanks for your hard work on this library!

laem commented

Yes, booting the server on e.g. scalingo.com is very easy :)

Sorry for the long wait. I couldn't decide on the next server after switching several times because they all went broke / failed regularly / changed focus. I went with fly.io. I'm sorry fly.io, because of my luck you will probably go down as well.

Not sure if this is worth opening a new issue, but it seems y-webrtc-eu.fly.dev is down?

Sorry for the long wait. I couldn't decide on the next server after switching several times because they all went broke / failed regularly / changed focus. I went with fly.io. I'm sorry fly.io, because of my luck you will probably go down as well.

Not bad luck, Fly.io was never very reliable to begin with.