[MUSIC]
>> I'd like to welcome Ken Chen
with us to talk more about
building real-time apps with
WebSockets and Azure Web PubSub.
Hey Ken, thanks for joining us.
>> Hey, Sana. It's really
good to be here to show some of our demos.
>> Cool. Can you tell us what's
new in Azure land for web developers?
>> Yeah. This time I have
some exciting news for web developers.
We just released a new service
called Azure Web PubSub service,
which can help the developers to easily
add real-time messaging features to web applications.
There is a common scenario
in web applications that you may
want your client apps to receive messages in real-time.
The message could be, for example,
like some system notification jamming on server-side,
or it could be also be something like
a chat messaging from another, a client device.
As you can see in this diagram,
so we start with a new Azure Web PubSub service.
You can connect your clients to
the service so you can easily get
real-time updates from the service.
We actually support a variety of clients
so you can see, for example, like web,
like mobile devices or like web pages running
the browsers or even other devices like gaming console.
The communication between the clients
and the service is actually
through a web socket technology which is pretty common.
As long as your client supports WebSockets,
you can use the service.
Actually traditionally, you may
be able to achieve this by using
other technologies like pooling
or running a self-hosted WebSockets server,
but this is really challenging especially you
have a lot of clients.
With the Web PubSub,
you don't need to handle those complexities.
Okay, cool. That's a really good explanation.
I know over the quarantine
a lot of people tried to do a lot
of personal projects, build web clients,
or websites that needed
real-time notifications, real-time messages,
and so they might have used
pooling but that's a good explanation
of why pooling might have delays or if you have lots of clients,
you might want to use WebSockets.
Could you give us a demo of
the Azure Web PubSub that you're talking about?
Yeah, sure. Yeah. I can quickly share
a demo so you can see how you can easily
use this new service to publish and
subscribe the messages between your client apps.
Here we have two Node.js console applications.
One is acting as the publisher
and one is acting as a subscriber.
You can see, in the publisher side we
actually just use the WebSockets.
You can see this should be the easiest something
you may be familiar with is the web socket API,
so you can just create a WebSocket connection
to a service and whenever the connection is open,
in this demo we just simply read
anything from the standard input
to send it to the service
to a group called stream, here you can see.
At the subscriber side you can also see we also use
a WebSocket here to put a connection to
the service and whenever the connection is open,
we just join stream group
by sending a joint group message,
and then you'll start to
receive messages from this group
so whenever there is a new message,
we just simply look at this event handler and
print anything you get from the service to the console.
Then now I will quickly run a demo.
Let me first run the subscriber part.
After it's connected, so I can run publisher.
Whenever I type anything,
you can see this being sent in
to the subscriber side in real-time.
For example, I can say, "Welcome to Build."
You can see this is streamed to
the subscriber side in real-time.
I can also send,
for example, large content.
You can see this whole time it's
actually streamed to the other side in real-time.
For example, this command.
Actually this order, these all files in this directory
and send them one by one to the other side.
If I click Enter, then I can see
datafile being listed in one directory and you can see this
is showing out on the other side in real-time.
Yeah, that's pretty much about this demo.
>> Okay, that's awesome. That's a really great demo.
I think that really drives home the point
of real-time client-server interaction.
You have one thing that's publishing,
one thing that's subscribing in real-time.
It's a really great example.
What if my app, like,
what if the server of a portion
of my app is actually running in a function?
I'm running a serverless scenario.
Can I take advantage of this Web PubSub?
>> Yeah, of course. Actually, this is
one of the many scenarios for Azure Web PubSub.
I think traditionally the error function
does not really support WebSocket.
You basically cannot serve
a long connection in a function call.
But with this service,
your clients can connect to
the service and your error functions you can use
our APIs to send message to clients and we also
provide a function extension so you
can create a Web PubSub figure.
There's a trigger for Web PubSub
and you can also send messages in an output binding.
So pretty handy. Yeah.
>> Okay, cool. Now another question.
What if my app or my website goes viral?
I'm getting tons of messages,
getting tons of clients connecting to my servers.
What's the scalability of Azure Web PubSub?
>> Yeah, so handling
a large-scale Web Sub connection
is usually a very challenging task.
You need to consider things like how to do load balancing
or how to synchronize data if you have multiple servers.
With Azure Web PubSub,
you don't need to deal with all these complexities.
You need to run scale command whenever you're
running out connections
and the servers will handle that for you.
And then we actually support up
to 100,000 connections for a single instance,
which should be pretty
sufficient for most of the cases.
>> Okay. That's really awesome to hear.
You say you can support up to a 100,000 messages.
What's the cost of this?
>> Yeah. We are currently in public view.
We actually have a free instance that you can try.
You can go to the Azure portal
and create a free instance to try out our services.
We also have a live demo so you
can even write a single line of code to try to service.
For the paid share actually is starting
from like $50 a month and you
can scale up to like any number of connections you need,
so the more connection you use you pay for more by
starting from $50 a month.
You can get all the benefits
as like nest a query or high availability or scalability.
Yeah. So feel free to try it. Let us know.
>> Great. Yeah. It's awesome to
hear there's a free trial.
If people want to learn more, can they go somewhere?
>> For sure. We have a documentations
and course samples at docs.Microsoft.com.
You can go to check that out.
>> Awesome. Feel free to try out the free trial and go to
docs to learn more about how to use Azure Web PubSub.
Thank you so much for joining us Ken.
>> Thank you Sana.