R
R
Roman Rakzin2016-02-28 15:10:16
JavaScript
Roman Rakzin, 2016-02-28 15:10:16

How to subscribe to like a photo on VKontakte and find out as soon as someone likes this photo?

How to subscribe to like a photo on VKontakte and find out as soon as someone likes this photo?
I created an application and there is a "Like" button (or another option - I'll just post a photo on VKontakte) and I need my server to immediately know that the photo was liked.
You can get likes https://vk.com/dev/likes.getList , but I want them to update themselves like VKontakte.

<script type="text/javascript" src="openapi.js"></script>

<div id="vk_like"></div>
 

<script type="text/javascript">

    VK.init({apiId: 5309489});
 
 
  VK.Widgets.Like("vk_like", {type: "button"},55);
  VK.Observer.subscribe("widgets.like.liked", function f()
  {
    alert ("Thank you for your like.");
  });

</script>  //этот код не работает в режиме реального времени

How to do something like this?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Dmitry, 2016-02-28
@TwoRS

Subscribe to events of their api
https://vk.com/dev/openapi_observer
An example is just about likes

A
Alexey Ukolov, 2016-02-28
@alexey-m-ukolov

Only by requesting likes.getList as often as possible.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question