►
Description
This is a presentation that Lukasz Gornicki recorded for the https://edasummit.com/
A
Hi,
my
name
is
lukas
gurnicki,
I'm
an
assistant,
api,
maintainer
and
a
community
guardian,
and
today
I'm
going
to
talk
to
you
about
asking
api
and
websocket,
but
I
choose
websocket
as
an
example
here,
because
that's
easier
to
explain
if
you're,
not
using
websocket
in
your
company
in
your
architecture,
that's
just
fine,
whatever
you're
gonna
see
today
actually
can
be
applied
to
to
any
even
driven
architecture
so
later
on.
If
you
want
to
ask
more
questions
and
you're
afraid
to
ask
them
in
public,
you
can
grab
my
personal
contacts.
A
You
can
write
some
private
message.
If
you
want
direct
message,
I
answer
all
the
inquiries,
so
no
worries
feel
free
to
contact
me
now
today.
The
plan
is
to
talk
about
four
things.
First
of
all
introduce
you
to
asking
api
specification
and
asking
api
initiative,
then
I
will
have
to
do
some
intro
to
websocket
anyway.
If
you
want
to
continue
around
the
websocket
topic,
then
I'm
gonna
tell
you
like
what
the
spec
and
even
driven
architectures
have
to
do
with
each
other.
A
What's
the
point
of
using
both
and
then
the
end,
some
live
coding,
so
yeah
first
specification
async
api.
So
the
goal
of
fasting
api
is
to
use
it.
For
example,
when
you
have
even
driven
microservices,
you've
got
some
kafka
message
broker
somewhere
in
the
middle,
a
bunch
of
services
that
talk
to
each
other
through
the
message
broker.
A
That's
the
moment
where
you
would
use
async
api,
another
use
case
internet
of
things.
Most
probably
you've
got
a
mqtt
broker
that
collects
messages
from
all
your
devices
and
then
makes
them
available
for
consumption
for
your
services.
Another
use
case
streaming
api,
so
let's
say
twitter,
you've
got
or
or
facebook
you've
got
a
a
browser.
You
want
to
see
a
live,
a
feat
that
refreshes
every
second
with
all
new
things
showing
up
and
that's
where
you
need
a
a
message
based
stream.
A
A
The
cool
stuff
is
that,
if
you
noticed
I
mentioned
like
three
different
protocols
I
mentioned,
I
talked
about
kafka.
I
talked
about
mqtt.
A
This
talk
is
about
websocket
and
the
cool
stuff
about
us
and
api
is
that
it's
protocol
agnostic,
so
you've
got
a
core
of
this
pack
that
you
can
use
to
describe
your
application,
but
you
also
have
a
feature
called
bindings,
so
we
can
describe
additional
protocol
specific
information
for
with
your
specification
for,
for
example,
kafka
or
or
mqtt
now
asking
api.
You
say
spec,
but
there's
also
asking
api
initiative
what
they
have
to
do
in
common.
A
So
asking
api
initiative
is
a
initiative
that
takes
care
of
the
spec.
But
what
is
differentiating
us
from
other
initiatives
like
that
or
other
open
source
organizations,
is
that
we
treat
equally
important
not
only
just
the
spec
but
also
the
tooling,
for
the
spec.
So
we
truly
believe
here
that
users
should
not
only
get
a
specification
from
us
with
latest
improvements,
but
at
the
same
time
we
should
also
deliver
basic
tooling.
So
you
can
use
from
day
one
the
spec
with
your
tools.
A
You
don't
have
to
wait
for
vendors
to
update
or
any
other
tooling
providers,
because
the
initiative
feels
responsible
for
making
sure
that
tools
work
pro
properly
with
the
with
the
specification,
and
we
provide
like
very
variety
of
tools:
docs
and
code
generators
like
parser
of
the
async
api
documents,
ui
and
cli
everything
focus
on
making
it
super
easy
to
work
with
the
spec.
A
A
So
we
always
have
to
do
a
bit
of
spying
and
and
a
lot
of
asking
and
discussions
with
different
people
to
learn
who
uses
async
api.
But
we
already
managed
to
to
learn
that
much
and
we
always
encourage
people
to
come
to
us
and
tell
us
like
that.
You
use
this
pack
and
how
you
do
it.
How
do
you
use
our
tools
now
if
it
comes
to
the
the
latest
history
of
this
pack
and
the
initiative
last
year
and
this
year?
A
It's
it's
super
active,
so
rapid
api
and
their
developer
survey
showed
that
asking
api
grew
in
adoption,
the
most
among
the
other
specs
by
three
times
in
production.
A
Thoughtworks
put
us
on
their
technology
rather
a
say
point
to
assess
in
the
future
and
info
cue
last
year,
put
us
on
their
innovators
place
and
this
year
or
on
early
adopters,
which,
basically
to
summarize
means,
if
you're
not
yet
using
async
api.
You
should
definitely
try
it
out
and
see
what
it
can
do
for
you
as
a
result
of
all
those
activities
like
a
lot
of
work.
A
So
that's
pretty
much
nicely
summarizes
the
the
activities
around
the
project
and
the
stage
where
we
are
so
we're
pretty
hyped
now
and
if
you
were
yeah
looking
for
some
cool
open
source
project
to
join
this
year,
I
think
asking
api
is
a
good
candidate
for
that
now
enough,
spec
websocket,
I'm
gonna
cover
basics,
so
sorry,
for
for
that,
but
I'm
gonna
base
the
basics
on
my
experience.
A
So
when
I've
heard
about
websocket
first
time,
I
think
it
was
six
seven
years
ago
it
was
related
to
to
my
work
on
a
building
ui.
A
I
had
a
front
end
and
I
wanted
to
build
a
really
nice
experience
for
the
user,
so
they
can
see
real-time
data
updated
in
the
browser
without
any
need
of
browser
refresh,
and
that
was
the
main
use
case
and
most
common
use
case
for
websockets.
So
you've
got
a
server
with
websocket
api
and
you've
got
a
browser,
a
client
where
you
can
open
a
single
connection
with
the
server
bidirectional.
A
So
you
can
send
messages
from
the
browser
to
the
server
and
also
there's
a
stream
of
messages
coming
from
the
server.
So
we
can
really
write
real
time,
update
the
user
interface
and
and
show
the
changes
to
the
user.
But
that's
not
the
only
use
case.
One
of
the
recent
most
known
use
cases
is
cryptocurrency
trackers,
so
you
know
crypto
currencies.
They
are
pretty
hype
these
years
and
they
are
yeah.
A
The
values
are
changing
pretty
rapidly
in
cryptocurrency,
so
you
need
a
way
to
get
access
to
the
latest
information
about
the
value
of
the
cryptocurrency,
really
in
real
time,
like
every
second
latest
latest
price
and
to
to
be
able
to
do
it.
The
what
was
chosen
by
the
by
by
devs
was
the
websocket
api,
so
all
those
trackers
they
expose
websocket
api,
where
you
can
again
consume
data
in
a
browser
or
another
server
and
react
to
the
latest
information
about
the
prices.
A
Now,
looking
from
a
different
perspective,
cartoon
perspective
on
the
architecture
of
websocket
is
when
you
try
to
compare
it
to
polling
http
polling.
So,
basically,
if
you
want
to
have
nice
ui
interface,
that
refreshes
without
manual
browser
refresh
in
the
background,
you
have
to
have
some
logic
that
uses
rest
api
and
every
few
seconds
tries
to
get
to
fetch
the
latest
information
from
the
api.
A
Not
so
cool
like
if
you
remember
the
scene
from
shrek
about
donkey,
asking
all
the
time
the
same
question
are
we
there
yet
are
we
there?
Yet
that
can
be
annoying
and
yeah?
I
mean
you
have
to
open
the
connection
with
the
server
every
time
you
do
it.
A
What's
the
point,
if
you
have
websocket,
where
you
can
just
open
one
connection
and
ask
for
the
updates
and
then
the
updates
are
regularly
delivered
to
you
whenever
something
changes
in
the
system,
you
don't
have
to
ping
the
system
all
the
time
and
it's
it's
pretty
nifty
and
have
a
variety
of
use
cases
what
they
have
in
common.
Like
spec
and
websocket,
I
mean
it's
back
right,
so
spec.
A
And
that's
it
and
I'm
afraid
that
many
people
just
do
it
for
that
purpose,
and
I
I
personally
feel
sorry
for
such
approach
because,
first
of
all,
sorry
for
me
and
other
maintainers
of
the
asking
api,
because,
like
putting
so
much
effort
into
the
spec
into
a
machine,
readable
format
that
you
can
really
consume
in
many
different
ways
in
your
system
and
doing
it
only
to
to
generate
dogs
and
don't
get
me
wrong,
I
mean
I'm
coming
from
my
technical
writing
background.
A
So
I
love
dogs
and
I
think
they
are
super
important.
But
if
you
write
a
spec
that
is
machine
readable,
you
describe,
for
example,
a
message
that
user
can
send
to
the
system
and
you
provide
a
schema
for
the
message
why
just
showing
it
as
a
part
of
documentation?
Why
not
using
it
to
generate
some
code?
Why
not
using
it
to
do
a
real-time
validation
of
the
messages
coming
to
the
into
the
service?
A
Why
not
do
all
those
different
things
for
testing
mocking
so
reusing?
One
content
for
many
different
use
cases
and
that's
gonna-
be
my
goal
now
so
enough,
slides
for
now,
I'm
gonna
jump
into
a
live
coding
session
and
I'm
going
to
show
you
a
asking
api
generator
in
action.
So
I'm
I'm
going
to
do
some
code
generation
but
yeah.
Let
me
quit
slides
and
open
visual
studio
code.
A
So
what
you
can
see
here
on
the
screen
is
my
face.
I'm
gonna
move
my
face
somewhere,
so
it's
not
disturbing
anymore,
so
you
can
see.
I
have
an
empty
project
with
just
a
single
yaml
file,
which
is
called
shrek
yaml
and
I'm
gonna
use
the
opportunity
to
say
hello
to
all
yaml
developers
around
kubernetes
project,
enough
jokes,
so
shrek
and
the
structure
of
the
document.
So
what
I
what
I
did
before
the
presentation
I
designed
my
shrek
application
using
async
api.
A
A
Now
channels
is
the
place
where
you
specify
all
the
different
connection
points
with
the
with
the
websocket
api
in
in
this
case.
So
I
have
a
chat,
a
channel
that
can
accept
messages
and
also
publishes
messages.
They
all
look
the
same,
and
it's
purely
for
chat.
Discussion.
A
Now.
The
last
part
of
the
document
is
components,
it's
mainly
for
reuse
purposes
and
to
make
the
document
much
cleaner,
cleaner.
So
you
can
see
here,
for
example,
it's
much
cleaner
to
read
channels
to
see
the
operations
you
can
do
with
the
channel
and
the
details
about
the
message
they're
just
in
the
components.
So
you
can
see.
The
chat
message
is
just
a
simple
string
in
case
of
travel
info.
A
Properties,
but
you
can
present
them
with
a
nice
example
of
the
payload,
so
as
simple
as
that
70
lines,
so
I
have
an
interface
of
my
application.
A
A
Okay,
so,
let's
for
now
just
close
this
file
bring
up
the
terminal
and
yeah.
Let's
do
some
first
generation,
so
I've
got
a
ag
is
asking
api
generator
installed.
A
A
A
A
A
I
mean
what
was
the
effort
worth
so,
let's
generate
some
code
again,
async
api
generator,
shrek,
yum
file
and
another
template,
not
html
template
but
node.js
websocket
template
and
I'm
going
to
put
it
in
different
folder
and
what
I
have
to
specify
is
what
server
I
want
to
use
during
the
generation,
because
I
can
have
two
different
servers
and,
of
course,
two
different
connection
points.
Sometimes
they
can
be
different.
A
A
You
can
see
that
two
routers
got
generated
so
we're
gonna,
listen
to
any
connection
to
chat
and
any
connection
to
travel
status.
So
you
recall
those
channels
from
the
from
the
file
and
yeah
important
have
a
look
here.
So
whenever
there
will
be
a
connection
to
chat
some
subchat
message
will
be
called.
A
There's
just
if
you
recall
this
channel
can
only
the
application
publishes
to
this
channel,
so
the
user
can
only
listen
to
the
messages
so
only
on
a
connection
subtravel
info
a
function
is
going
to
be
called
so
far
so
good.
So,
let's
see
those
functions.
So
we
have
two
services
generated
for
chat,
channel
and
travel
status.
Travel
status
has
just
this
one
function
with
some
placeholder
that
we
should
replace
and
chat
because
it
had
two
operations
subscribe
and
publish.
A
It
has
two
different
functions
with
also
placeholders,
and
what
we're
gonna
do
here
is
we're
just
gonna
replace
the
logic
here
in
those
in
those
generated
functions.
A
It's
node.js,
so
npm
install
now
my
use
case
is
travel
status
has
to
send
messages.
Of
course,
I
don't
have
information
about
any
real
travel,
so
I'm
gonna
have
to
mock
those.
This
data
and
I'm
gonna,
use
some
package
for
it
and
in
case
of
chat,
I
actually
set
it
up
a
real
chatbot
that
I
trained
with
with
ai
and
to
talk
to
this
rest,
api
of
the
of
the
chatbot
I'm
gonna
have
to
use
the
the
node
fetch
package.
A
First
of
all,
yeah
with
chat,
I'm
gonna
have
to
talk
to
rest
api
of
a
real
chatbot,
so
yeah.
I
need
to
have
some
tokens,
so
that's
why
here
I'm
importing
the
configuration
from
the
project.
A
A
Let
me
paste
some
logic
here
so
to
not
bore
you
with
the
node.js
code.
The
most
important
to
notice
is
here
so
once
we
get
a
message
from
the
client,
the
server
forwards,
the
message
to
the
with
ai
interface,
with
the
token
that
we
will
soon
provide
and
then,
of
course,
the
chat
bot
replies
and
this
bot
answer
is
later
on
sent
back
to
the
client
and
it's
also
locked
in
the
in
the
console
log.
So
we
can
see
that
it
really
happens
on
the
server
side.
A
Okay,
that's
that's
it!
If
it
comes
to
the
chat
now
travel
status
here
we
need
to
import
the
dummy
dummy
json.
A
A
A
A
I'm
doing
it
because
I
have
this
luxury
that
right
after
the
recording,
I
can
actually
regenerate
the
token.
So
that's
why
I'm
so
smart
here,
okay,
everything
is
ready.
Everything
is
in
place.
Let's
start
the
server.
A
A
Start
so
far,
so
good
listening
on
port
80..
Now
on
the
left
side,
you
see
the
the
started
server
and
now
on
the
other
terminal,
I'm
gonna
talk
to
the
server
from
the
client
side.
I'm
gonna
use
a
tool
called
websocket
which
is
like
curl
for
rest
api,
but
websocket
is
for
websocket
and
I'm
gonna
connect
with
our
localhost
server.
A
So
you
see
this
information
that
I
could
read
from
the
asking
api
file
and
the
chat
the
chat
channel
after
connection,
I
got
an
answered
from
the
server
welcome
to
the
shrek
chat
and
the
client
got
connected
so
far,
so
good,
so
yeah.
Let's
write
something
like
high.
A
Yeah,
that's
something
that
will
pretty
soon
happen
to
front
too
so
anyway,
that's
the
discussion
with
the
with
the
chat
bot.
That's
the
client
part.
This
is
the
the
server,
so
you
could
see
every
time
the
message
was
received.
It
went
to
the
server,
it
was
locked
and
the
answer
was
also
locked.
So
it
was
a
pure
communication
between
client
and
the
server
the
cool
stuff
about
the
code
generation.
Is
that
you?
Don't
only?
Can
you
don't
only
generate
server?
A
You
can
also
generate
client,
so
you
don't
have
to
use,
for
example,
websocket
and
that's
what
we're
gonna
do
when
we
will
play
with
the
other
channel.
So
let's
have
a
look
again
on
the
generated
project
except
of
src.
We
also
generated
super
simple,
like
really
super
simple,
primitive
index
html
with
some
basic
api
to
talk
to
the
server
as
a
say,
client,
you
can
see
that
we
during
the
generation
we
took
information
from
the
server
section
of
the
of
the
spec,
so
yeah.
Let
us
let
us
open
up
the
index
file
in
the
browser.
A
Okay,
so
we
disconnected
from
the
channel
and
open
okay.
So,
as
you
can
see,
it's
pretty
primitive,
nothing
in
the
ui,
just
information
to
open
the
console
of
the
browser.
Still
it's
a
client.
We
have
some
docs
generated,
so
we
know
what
channels
we
can
connect
with
and
we'll
connect
with
travel
status.
A
A
I
was
also
able
to
generate
the
server
and
the
client
and
just
focus
on
on
putting
some
some
business
logic
and
that's
it
and
there
are
more
use
cases
like
testing
of
this
application,
or
I
could
have
a
real-time
validation
of
the
messages
so,
for
example,
in
the
chat,
if
I
would
try
to
send
something
different
like
a
json,
for
example,
instead
of
string,
I
could
validate
it
on
the
server
side
and
say:
okay
message
is
not
accepted,
and
reply
back
to
the
client
like
message
is
wrong
or
something
like
this.
A
So
back
to
the
last
slide,
like
the
goodbye
slide.
So
if
you
got
interested
with
the
topic,
I
definitely
encourage
you
to
to
explore
more
about
asking
api.
A
It's
it's
a
pretty
big
topic
with
many
different,
interesting
use
cases.
Many
different
tools
already
in
with
major
release
many
tools
in
the
in
the
pipeline
to
deliver
we're
looking
a
lot
of
for
all
many
people
to
support
us
and
help
us
out.
So
I
hope
that
after
this
call,
we're
gonna
see
each
other
again
on
this
luck,
workspace!