diff --git a/app/components/viewer/index.js b/app/components/viewer/index.js
index 4a00bee064bb0adec1fa6fca292aa26f472b882e..c9e0470f75a7612cc4e0978f34c5670e9935283d 100644
--- a/app/components/viewer/index.js
+++ b/app/components/viewer/index.js
@@ -6,6 +6,17 @@ import { inject as service } from '@ember/service';
 export default class ViewComponent extends Component {
 
   @service requests;
+  @service websockets;
+
+  constructor(owner, args) {
+    super(owner, args);
+
+    this.websockets.addHandler(this.messageHandler, this);
+  }
+
+  messageHandler(message) {
+    console.log(message);
+  }
 
   @action
   onRunOCR() {
diff --git a/app/services/websockets.js b/app/services/websockets.js
new file mode 100644
index 0000000000000000000000000000000000000000..497787581e64bbf929a272cc7005372e06393d01
--- /dev/null
+++ b/app/services/websockets.js
@@ -0,0 +1,37 @@
+import ENV from 'papermerge/config/environment';
+import Service from '@ember/service';
+
+
+export default class Websockets extends Service {
+
+
+  constructor(owner, args) {
+    super(owner, args);
+
+    let that = this;
+
+    this._socket = new WebSocket(this.base_url);
+    this._handlers = [];
+
+    this._socket.onmessage = function(event) {
+      that._handlers.forEach((item) => {
+        let json_data;
+
+        try {
+          json_data = JSON.parse(event.data);
+          item.handler.apply(item.context, [json_data, event]);
+        } catch (err) {
+          console.log(`Error while parsing incoming data: ${event.data}`);
+        }
+      });
+    }
+  }
+
+  get base_url() {
+    return `${ENV.APP.WS_HOST}/${ENV.APP.WS_NAMESPACE}`;
+  }
+
+  addHandler(handler, context) {
+    this._handlers.push({handler, context});
+  }
+}
\ No newline at end of file
diff --git a/config/environment.js b/config/environment.js
index b84439c077a54855ad780ed4ba041b2b96431fb8..ab2ea0695240c1109e6f6e3ef631711ae93ca6f2 100644
--- a/config/environment.js
+++ b/config/environment.js
@@ -18,7 +18,8 @@ module.exports = function (environment) {
     },
 
     APP: {
-      NAMESPACE: 'api'
+      NAMESPACE: 'api',
+      WS_NAMESPACE: 'ws/document'  // websockets namespace
       // Here you can pass flags/options to your application instance
       // when it is created
     },
@@ -26,6 +27,7 @@ module.exports = function (environment) {
 
   if (environment === 'development') {
     ENV.APP.HOST = 'http://127.0.0.1:8000'
+    ENV.APP.WS_HOST = 'ws://127.0.0.1:8000'  //websockets
     // ENV.APP.LOG_RESOLVER = true;
     // ENV.APP.LOG_ACTIVE_GENERATION = true;
     // ENV.APP.LOG_TRANSITIONS = true;