►
Description
Celebrating the first stable multi-platform release of y-rb https://rubygems.org/gems/y-rb with a demo of my development sandbox.
A
Hey
folks,
this
is
another
update
about
my
work
on
real-time
editing,
official
descriptions
and
this
week,
I
want
to
celebrate
the
release
of
the
the
first
stable
release
of
the
multi-platform
by
Ruby
champ,
with
a
neat
little
demo,
and
you
know
actually
demonstrate
what
we
can
do
with
my
Ruby,
because
I
think
it's
sometimes
unclear
or
sometimes
people
don't
understand
why
we
need
a
Ruby
version
of
crdt
and
why
it
needs
to
be
a
perfect
content,
part
to
the
bike.
A
Gs
Unity
we
are
already
using
on
in
our
front
end
or
we
are
planning
to
be
using
our
gitlab
front
end.
So
I
have
this
little
sandbox
that
I
use
for
development
of
all
real-time
collaboration
related
features,
because
it
allows
me
to
iterate
quickly
and
to
try
stuff
that
never
makes
it
into
the
product.
You
know
like
go
a
bit
crazy.
That
kind
of
thing
use
a
perfect
environment
in
terms
of
like
which
Editor
to
use,
etc,
etc.
A
So
what
you
see
here
is
what
I
think
you
should
have
named
it
better,
but
it's
called
gitlab
docs
of
gitlab
docs.
You
can,
you
know,
create
documents
you
can.
Actually.
Let
me
show
that,
because
I'm
super
proud
of
it,
you
can
log
in
with
your
gitlab
account
and
it
supports
single
sign-on
via
oauth
2.,
so
perfect,
nice
exactly
how
it
should
work
so
open
a
document
start
typing
and
do
stuff
excellent.
It
works
as
expected.
A
good
Market,
bold
I
can't
do
you
know
the
text
editor
or
the
text.
A
The
document
editor
kind
of
thing,
but
most
people
know
when
it
comes
or
what
most
people
expect
when
it
comes
to
real-time
collaboration.
Is
this
feature
here
right?
So
we
are
on
one
machine
and
we
start
typing
and
then
on
the
right
side,
things
get
deleted
or
added,
as
well
as
I
type
on
the
left
side
and
vice
versa.
So
perfect,
real-time
calibration
Done
Right,
but
it's
not
as
easy
as
that,
because
we
have
another
part
in
the
system
and
it's
a
quite
important
one.
A
Our
server
and
gitlab
is
built
with
Ruby
and
rails,
and
so
we
also
need
to
somehow
we
need
to
be
able
to
interact
with
what
is
the
front
end
here.
Also,
on
the
back
end,
the
reason
is
relatively
simple,
like
just
look
at
when
we
load
this
document
here,
it's
instantaneously
rendered,
but
it's
not
stored
on
the
client
side.
So
how
do
we
store
what
seems
to
be
a
series
data
structure
written
in
JavaScript
on
the
server
side?
A
And
this
is
where
rivalry
comes
into
play
and
I
want
to
actually
demo
how
it
is
done.
So
I'm
going
to
open
up
this
nice
little
race
console
here
and
then
we
will
dive
a
bit
deeper
into
the
server
side.
First,
let
me
load
our
my
ruby.
Gem
I
should
learn
to
type
and
let's
create
a
document.
So
let's
create
a
new
document.
The
document
is
empty,
there's
nothing
in
there
and
we
want
to
actually
initialize
this
text
field
here.
So
one
important
piece
of
information:
this
is
not
stored
as
pure
text.
A
It's
stored
as
a
relatively
complex
XML
structure,
so
I
need
to
go
and
use
the
XML
element
here.
Instead
of
a
map
area
or
text,
the
name
is
default
because
creativity
or
lack
of
creativity
and
if
I
print
this
to
a
string.
What
I
see
is
nothing
because
it's
an
empty
XML
container,
there's
nothing
in
there.
What
we
can
do,
though,
is
we
can
sync
our
local
document
with
all
the
changes
to
our
server
site
document,
and
we
can
do
this
by
using
the
sync
method
and
applying
a
div.
A
The
good
thing
is
everything
I
type
here
on
the
left
side
is
already
persisted
on
the
server
into
a
database,
and
I
can
just
request
a
change
from
the
database
and
sync
it
with
my
in-memory
document
on
the
server.
So
when
I
do
this
and
I
have
synced
it
successfully.
What
I
should
see
here
now
is
a
very
complex,
XML
structure.
A
You
can
see
the
heading
here
with
Hello
World,
perfect
lines
up
with
what
we
see
on
the
left
side,
a
couple
of
paragraph
code
blocks
Etc,
so
this
is
all
nice
and
fancy,
but
what
if
we
want
to
support
what?
If
we
want
to
change
something
on
the
server
and
broadcast
it
back
to
the
client
side,
this
actually
works,
and
this
is
pretty
cool.
So,
let's
try
to
let's
try
this
by
changing
the
heading,
so
the
first
shell
in
the
element
is
the
heading
here:
I
can
actually
print
this
to
string
as
well.
A
I
will
see
the
heading
level.
One
hello
world
is
printed
is
printed
as
except
expected
and
now
I'm
going
to
insert
additional
text
at
position,
1,
which
is
after
the
existing
text,
because
it's
a
zero
based
offset
and
I
just
say
and
I
want
to
say
hello
from
the
server
as
well
so
cool
text
inserted,
we
can
again
print
The
Heading.
We
could
also
decide
to
just
print
the
whole
XML
and
see
if
it's
in
there
as
well,
fantastic
and
but
we're
still
lacking
like
an
update
on
the
client
side.
A
What
we
can
do
here
is
we
can
utilize
the
same
mechanism
that
we
use
to
sync
between
the
two
clients,
the
two
front-end
clients.
We
can
also
just
do
the
same
thing
on
the
server.
So
what
I
do
here
is
I
can
use
my
action,
cable,
my
websocket
connection
and
broadcast
to
the
document.
The
latest
change
I
made
so
I
just
take
the
dock
that
I
created
I,
create
I.
Take
the
diff
and
I
broadcast
it
to
the
client
and
boom.
A
A
The
the
whole
thing
was
going
to
be
available
within
gitlab,
obviously,
obviously,
and
there's
a
couple
of
other
things
that
we
have
they
had
to
implement
besides
by
Ruby.
In
order
to
make
this
work,
we
need
a
way
to
efficiently
persist,
CDT
structures
on
the
server
we
are
using
redis
for
this,
and
the
other
thing
is,
we
need
some
abstraction
on
top
of
action,
cable,
which
is
rails,
websocket
implementation
to
create
a
nice
way
of
binding
ygs
and
send
binding
ygs
with
with
action,
cable
messages
cool.
A
So
that's
it
yeah
and
I'm
really
looking
forward
to
see
this
actually
work
in
gitlab
issues
in
the
future.
Bye.