Skip to content

Latest commit

 

History

History
18 lines (11 loc) · 1.87 KB

File metadata and controls

18 lines (11 loc) · 1.87 KB

8 Web services

Web services allows you use formats like XML or JSON to exchange information through HTTP. For example you want to know weather of Shanghai tomorrow, share price of Apple, or commodity information in Amazon, you can write a piece of code to get information from open platforms, just like you call a local function and get its return value.

The key point is that web services are platform independence, it allows you deploy your applications in Linux and interactive with ASP.NET applications in Windows; same thing, there is no problem of interacting with JSP in FreeBSD as well.

REST and SOAP are most popular web services in these days:

  • Requests of REST is pretty straight forward because it's based on HTTP. Every request of REST is actually a HTTP request, and server handle request by different logic methods. Because many developers know HTTP much already, REST is like in their back pockets. We are going to tell you how to implement REST in Go in section 8.3.
  • SOAP a standard of across network information transmission and remote computer function calls, which is launched by W3C. The problem of SOAP is that its specification is very long and complicated, and it's still getting larger. Go believes that things should be simple, so we're not going to talk about SOAP. Fortunately, Go provides RPC which has good performance and easy to develop, so we will introduce how to implement RPC in Go in section 8.4.

Go is the C language of 21st century, we aspire simple and performance, then we will introduce socket programming in Go in section 8.1 because many game servers are using Socket due to low performance of HTTP. Along with rapid development of HTML5, websockets are used by many page game companies, and we will talk about this more in section 8.2.

Links