Skip to content

Commit 9c176d8

Browse files
authored
Merge pull request #51 from VinayApposite/Apposite_20480C_Mod13_LAK
Apposite 20480 c mod13 lak
2 parents e71fe70 + d815e21 commit 9c176d8

File tree

1 file changed

+36
-35
lines changed

1 file changed

+36
-35
lines changed

Instructions/20480C_MOD13_LAK.md

Lines changed: 36 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,30 @@
1-
# Module 13: Implementing Real-time Communication by Using Web Sockets.
1+
# Module 13: Implementing Real-time Communication by Using Web Sockets
22

3-
# Lab: Performing Real-time Communication by Using Web Sockets.
3+
# Lab: Performing Real-time Communication by Using Web Sockets
44

55
### Lab Setup
66

77
### Preparation Steps
88

9-
1. Ensure that you have cloned the 20480C directory from GitHub. It contains the code segments for this course's labs and demos. https://github.com/MicrosoftLearning/20480-Programming-in-HTML5-with-JavaScript-and-CSS3/tree/master/Allfiles.
9+
Ensure that you have cloned the 20480C directory from GitHub (https://github.com/MicrosoftLearning/20480-Programming-in-HTML5-with-JavaScript-and-CSS3/tree/master/Allfiles). It contains the code segments for the labs and demos in this course.
1010

11-
### Exercise 1: Receiving Messages from a Web Socket.
11+
### Exercise 1: Receiving Messages from a Web Socket
1212

13-
#### Task 1: Review the Live page.
13+
#### Task 1: Review the Live page
1414

15-
1. Open **Visual Studio 2017**.
15+
1. Open **Microsoft Visual Studio 2017**.
1616
2. In Visual Studio, on the **File** menu, point to **Open**, and then click **Project/Solution**.
1717
3. In the **Open Project** dialog box, browse to **Allfiles\Mod13\Labfiles\Starter\Exercise 1**, click **ContosoConf.sln**, and then click **Open**.
1818
4. On the **Debug** menu, click **Start Without Debugging**.
19-
5. In Microsoft Edge, if the message **Intranet settings are turned off by default** appears, click **Don’t show this message again**.
19+
5. In Microsoft Edge, if the **Intranet settings are turned off by default** message appears, click **Don’t show this message again**.
2020
6. Click **Live**.
2121
7. In the **Webpage Error** dialog box, click **No**.
2222
8. Verify that the **Live** page looks like the following image:
2323

2424
![alt text](./Images/20480B_13_Live.png "The Live page")
2525

2626
9. Close Microsoft Edge and return to Visual Studio.
27-
10. In Solution Explorer, expand the **ContosoConf** project, and then double-click **live.htm**.
27+
10. In **Solution Explorer**, expand the **ContosoConf** project, and then double-click **live.htm**.
2828
11. Verify that this page contains the following HTML markup:
2929
```html
3030
<form action="#">
@@ -40,13 +40,14 @@
4040
```html
4141
<script src="/scripts/pages/live.js" type="text/javascript"></script>
4242
```
43-
13. In Solution Explorer, expand the **scripts** folder, expand the **pages** folder, and then double-click **live.js**.
43+
13. In **Solution Explorer**, expand the **scripts** folder, expand the **pages** folder, and then double-click **live.js**.
4444
14. Verify that the file contains the following JavaScript code:
45-
```javascript
45+
```
46+
javascript
4647
var LivePage = Object.inherit({
4748
```
4849

49-
#### Task 2: Receive messages by using a web socket.
50+
#### Task 2: Receive messages by using a web socket
5051

5152
1. In **live.js**, find the following comment near the end of the file:
5253
```javascript
@@ -56,7 +57,7 @@
5657
```javascript
5758
var socket = new WebSocket("ws://localhost:[port]/live/socket.ashx");
5859
```
59-
3. Scroll to the top of the file and find the following comment:
60+
3. Scroll to the top of the file and find the following comment:
6061
```javascript
6162
// TODO: Assign a callback to handle messages from the socket.
6263
```
@@ -65,7 +66,7 @@
6566
this.socket.onmessage = this.handleSocketMessage.bind(this);
6667
```
6768

68-
#### Task 3: Display questions received as messages.
69+
#### Task 3: Display questions received as messages
6970

7071
1. In **live.js**, find the following comment:
7172
```javascript
@@ -79,7 +80,7 @@
7980
```javascript
8081
// TODO: Check if message has a `questions` property, before calling handleQuestionsMessage
8182
```
82-
4. Modify the statement following this comment, as shown below in bold:
83+
4. Modify the statement following this comment, as shown below:
8384
```javascript
8485
if (message.questions) {
8586
this.handleQuestionsMessage(message);
@@ -93,7 +94,7 @@
9394
this.questionListElement.appendChild(item);
9495
}
9596
```
96-
6. Find the following comment in the **handleQuestionsMessage()** function:
97+
6. Find the following comment in the **handleQuestionsMessage()** function:
9798
```javascript
9899
// TODO: Display each question in the page, using the displayQuestion function.
99100
```
@@ -104,27 +105,27 @@
104105
}
105106
```
106107

107-
#### Task 4: Test the application.
108+
#### Task 4: Test the application
108109

109110
1. In Solution Explorer, double-click **live.htm**.
110111
2. On the **Debug** menu, click **Start Without Debugging**.
111112
3. In Microsoft Edge, once the page has loaded, wait five seconds.
112113
4. Verify that the page displays the following four questions:
113-
- What are some good resources for getting started with HTML5?
114-
- Can you explain more about the Web Socket API, please?
115-
- This is an #&!%!* inappropriate message!!
116-
- How much of CSS3 can I use right now?
114+
- **What are some good resources for getting started with HTML5?**
115+
- **Can you explain more about the Web Socket API, please?**
116+
- **This is an #&!%!* inappropriate message!!**
117+
- **How much of CSS3 can I use right now?**
117118
5. Close Microsoft Edge.
118119

119-
>**Results:** After completing this exercise, you will have added JavaScript code to the **Live** web page to receive questions from a web socket and to display them.
120+
>**Results:** After completing this exercise, you will have added a JavaScript code to the **Live** web page to receive questions from a web socket and to display them.
120121
121-
### Exercise 2: Sending Messages to a Web Socket.
122+
### Exercise 2: Sending Messages to a Web Socket
122123

123-
#### Task 1: Format a question as a message.
124+
#### Task 1: Format a question as a message
124125

125126
1. In Visual Studio, on the **File** menu, point to **Open**, and then click **Project/Solution**.
126127
2. In the **Open Project** dialog box, browse to **Allfiles\Mod13\Labfiles\Starter\Exercise 2**, click **ContosoConf.sln**, and then click **Open**.
127-
3. In Solution Explorer, expand the **ContosoConf** project, expand the **scripts** folder, expand the **pages** folder, and then double-click **live.js**.
128+
3. In **Solution Explorer**, expand the **ContosoConf** project, expand the **scripts** folder, expand the **pages** folder, and then double-click **live.js**.
128129
4. Verify that the **live.js** file contains the following function:
129130
```javascript
130131
askQuestion: function (text) {
@@ -157,7 +158,7 @@
157158
var json = JSON.stringify(message);
158159
```
159160

160-
#### Task 2: Send the message to the web socket.
161+
#### Task 2: Send the message to the web socket
161162

162163
1. In **live.js**, find the following comment:
163164
```javascript
@@ -168,7 +169,7 @@
168169
this.socket.send(json);
169170
```
170171

171-
#### Task 3: Test the application.
172+
#### Task 3: Test the application
172173

173174
1. In Solution Explorer, double-click **live.htm**.
174175
2. On the **Debug** menu, click **Start Without Debugging**.
@@ -178,17 +179,17 @@
178179
6. Verify that the list of questions displays **This is a test.**
179180
7. Click the first Microsoft Edge tab.
180181
8. Verify that the list of questions includes **This is a test.**
181-
9. Close Microsoft Edge.
182+
9. Close Microsoft Edge.
182183

183184
>**Results:** After completing this exercise, you will have modified the **Live** question page to enable users to ask questions by sending messages to the server by using the web socket.
184185
185-
### Exercise 2: Handling Different Web Socket Message Types.
186+
### Exercise 2: Handling Different Web Socket Message Types
186187

187-
#### Task 1: Display report links.
188+
#### Task 1: Display report links
188189

189190
1. In Visual Studio, on the **File** menu, point to **Open**, and then click **Project/Solution**.
190191
2. In the **Open Project** dialog box, browse to **Allfiles\Mod13\Labfiles\Starter\Exercise 3**, click **ContosoConf.sln**, and then click **Open**.
191-
3. In Solution Explorer, expand the **ContosoConf** project, expand the **scripts** folder, expand the **pages** folder, and then double-click **live.js**.
192+
3. In **Solution Explorer**, expand the **ContosoConf** project, expand the **scripts** folder, expand the **pages** folder, and then double-click **live.js**.
192193
4. In **live.js**, find the following code:
193194
```javascript
194195
createReportLink: function () {
@@ -203,12 +204,12 @@
203204
```javascript
204205
//item.appendChild(this.createReportLink());
205206
```
206-
6. Modify this statement and remove the // characters, as shown in the following JavaScript code:
207+
6. Modify this statement and remove the __//__ characters, as shown in the following JavaScript code:
207208
```javascript
208209
item.appendChild(this.createReportLink());
209210
```
210211

211-
#### Task 2: Send the report message.
212+
#### Task 2: Send the report message
212213

213214
1. In **live.js**, find the following function:
214215
```javascript
@@ -232,7 +233,7 @@
232233
this.socket.send(JSON.stringify({ report: questionId }));
233234
```
234235

235-
#### Task 3: Handle Remove Question messages.
236+
#### Task 3: Handle Remove Question messages
236237

237238
1. In **live.js**, find the **handleRemoveMessage()** function:
238239
```javascript
@@ -258,7 +259,7 @@
258259
}
259260
}
260261
```
261-
3. Modify the JavaScript code in the **handleSocketMessage** method as shown below in bold:
262+
3. Modify the JavaScript code in the **handleSocketMessage** method as shown below:
262263
```javascript
263264
handleSocketMessage: function (event) {
264265
// TODO: Parse the event data into message object.
@@ -271,7 +272,7 @@
271272
}
272273
```
273274

274-
#### Task 4: Test the application.
275+
#### Task 4: Test the application
275276

276277
1. In Solution Explorer, double-click **live.htm**.
277278
2. On the **Debug** menu, click **Start Without Debugging**.

0 commit comments

Comments
 (0)