diff --git a/TugasBesar2_2017/WebApp/src/main/webapp/WEB-INF/chat_driver.jsp b/TugasBesar2_2017/WebApp/src/main/webapp/WEB-INF/chat_driver.jsp
index dea4987c973326dac18750656f5b1750a11fa199..6166f08d96f48e6fc1c3b75fea645ed4b84bdd24 100644
--- a/TugasBesar2_2017/WebApp/src/main/webapp/WEB-INF/chat_driver.jsp
+++ b/TugasBesar2_2017/WebApp/src/main/webapp/WEB-INF/chat_driver.jsp
@@ -70,34 +70,49 @@
 <script>
     angular.module('chatApp', [])
         .service('ConverseService', converse)
-        .controller('ChatController', function ($scope, ConverseService) {
+        .controller('ChatController', function ($scope, $timeout, ConverseService) {
             let account = new ConverseService.User(1)
 
             $scope.chatList = []
 
             // Initialize Firebase.
             account.initAsync()
-                .then(function () {
+                .then(function (chats) {
                     console.log('Chat service is initialized.')
+
+                    $timeout(function () {
+                        $scope.chatList = chats
+                    }, 0)
                 })
                 .catch(function (e) {
                     console.log(e)
                 })
 
             account.onchat = function (msg) {
-                $scope.chatList.push({
-                    from: 'them',
-                    text: msg
-                })
-                $scope.$apply()
+                $timeout(function () {
+                    $scope.chatList.push({
+                        from: 'them',
+                        text: msg
+                    })
+                }, 0)
             }
 
             $scope.addChat = function () {
                 if ($scope.chatText.length !== 0) {
-                    $scope.chatList.push({
-                        from: 'me',
-                        text: $scope.chatText
-                    });
+                    let message = $scope.chatText
+
+                    account.chatAsync(message)
+                        .then(function () {
+                            $timeout(function () {
+                                $scope.chatList.push({
+                                    from: 'me',
+                                    text: message
+                                })
+                            }, 0)
+                        })
+                        .catch(function (e) {
+                            console.log(e)
+                        })
                 }
 
                 $scope.chatText = ''
diff --git a/TugasBesar2_2017/WebApp/src/main/webapp/js/converse.js b/TugasBesar2_2017/WebApp/src/main/webapp/js/converse.js
index 71a6279538cd63867733cfeae032481ad60b836d..2867f425146bc3c3b1d97daaa0958fb64425fdb6 100644
--- a/TugasBesar2_2017/WebApp/src/main/webapp/js/converse.js
+++ b/TugasBesar2_2017/WebApp/src/main/webapp/js/converse.js
@@ -40,9 +40,10 @@ let converse = function ($http) {
         let data = JSON.stringify({
           'token': await messaging.getToken()
         })
+        console.log(data)
 
         let response = await $http.post(`${apiUrl}/driver/${this.id}/chat/init`, data)
-        return response.chats
+        return response.data.chats
       } catch (e) {
         console.log(e)
         alert('Unable to initialize chat service.')
@@ -59,8 +60,8 @@ let converse = function ($http) {
   }
 
   class Driver extends Account {
-    async waitAsync (locations, timeout) {
-      let response = await $http.post(`${apiUrl}/driver/${this.id}/wait`, null, {
+    async waitAsync (timeout) {
+      let response = await $http.post(`${apiUrl}/driver/${this.id}/wait`, '', {
         timeout: timeout
       })