import React from 'react'; import clsx from 'clsx'; import { FiGithub, FiPlay } from 'react-icons/fi'; import { TbChefHat, TbPingPong, TbRepeat, TbServer, TbShield, } from 'react-icons/tb'; import { BsBoxSeam } from 'react-icons/bs'; import { FaCreativeCommonsZero } from 'react-icons/fa'; import { MdOutlineHdrStrong } from 'react-icons/md'; import { Anchor, Image } from '@theguild/components'; import Link from 'next/link'; const classes = { button: { gray: 'inline-block bg-gray-200 hover:bg-gray-300 dark:bg-gray-800 dark:text-gray-300 dark:hover:bg-gray-700 text-gray-600 px-6 py-3 rounded-lg font-medium shadow-sm', lime: 'inline-block bg-lime-200 hover:bg-lime-300 dark:bg-lime-800 dark:text-lime-300 dark:hover:bg-lime-700 text-lime-600 px-6 py-3 rounded-lg font-medium shadow-sm', }, link: { blue: 'text-blue-600 hover:text-blue-800 dark:hover:text-blue-400', lime: 'text-lime-600 hover:text-lime-800 dark:hover:text-lime-400', }, }; const gradients: [string, string][] = [ ['#eab308', '#a16207'], // yellow ['#6366f1', '#4338ca'], // indigo ['#84cc16', '#4d7c0f'], // lime ]; function pickGradient(i: number) { const gradient = gradients[i % gradients.length]; if (!gradient) { throw new Error('No gradient found'); } return gradient; } export function Index() { return ( <>

GraphQL WS

Zero-dependency, lazy, simple, spec compliant server and client

Get Started Recipes GitHub

As a reference implementation, the library is fully compliant with the{' '} GraphQL over WebSocket spec

, title: 'Resilient', description: 'Adaptable to enterprise requirements', }, { icon: , title: 'Secure', description: 'Strong authentication rules through an easy API', }, { icon: , title: 'Pings and pongs', description: 'Measure latency and keep connection liveliness', }, ]} />
} />

Single library, but both the server and the client is included

, title: 'Zero-dependency', description: 'Library contains everything it needs', }, { link: 'https://bundlephobia.com/package/graphql-sse', icon: , title: 'Still small bundle', description: 'Thanks to tree-shaking and module separation', }, { icon: , title: 'Smart retry strategies', description: 'Customize the reconnection process to your desires', }, { icon: , title: 'Choose your server', description: 'Multiple WebSocket server implementations available', }, ]} />
} />
} title="Recipes" description={

Short and concise code snippets for starting with common use-cases

  • Client usage with AsyncIterator
  • Client usage with Relay
  • Server handler usage with custom context value
  • Server handler and client usage with persisted queries
  • And many more...
} />
); } function Wrapper({ children }: { children: React.ReactNode }) { return (
{children}
); } function Feature({ icon, title, description, children, image, gradient, flipped, }: { children?: React.ReactNode; icon?: React.ReactNode; title: string; description: React.ReactNode; highlights?: { title: string; description: React.ReactNode; icon?: React.ReactNode; }[]; image?: string; gradient: number; flipped?: boolean; }) { const [start, end] = pickGradient(gradient); return (
{icon && (
{icon}
)}

{title}

{description}
{image && (
{title}
)}
{children}
); } function FeatureHighlights({ highlights, textColor, }: { textColor?: string; highlights?: { title: string; description: React.ReactNode; icon?: React.ReactNode; link?: string; }[]; }) { if (!Array.isArray(highlights)) { return null; } return ( <> {highlights.map(({ title, description, icon, link }) => { const Comp = link ? Anchor : 'div'; return ( {icon && (
{icon}
)}

{title}

{description}

); })} ); }