Chapter 19. Networking basics
This chapter covers
- Asynchronous communication and Reactive Extensions
- The web request and response pattern
- Cross-domain concerns and data security
- The browser and client networking stacks
- Connectivity
It’s truly rare these days to find an application that doesn’t use the network for something. Client-side applications often phone home to check for updates, connected applications rely on services for significant functionality, games check for banned users and cheats across the wire, and business applications almost always rely on data coming from a server somewhere.
In chapter 1, I introduced networking in Silverlight by showing you how to create a simple Twitter application. That example showed some of the simplest network interactions used to call a REST-style service to grab some data. I hope that example whetted your appetite to learn how networking works.
Silverlight wouldn’t be a particularly useful product if it didn’t include excellent networking support. Networking is so important that this area is one of the only places in Silverlight where there are two parallel code branches that accomplish approximately the same thing: two complete networking stacks.
The two stacks included in Silverlight are known as the browser HTTP stack and the client HTTP stack. As their names indicate, the browser HTTP stack goes directly through the browser for all networking calls, whereas the client HTTP stack doesn’t.