如何在节点js中使用Twitter API实现直接消息流?

时间:2017-02-22 13:43:00

标签: node.js twitter stream nodes twitter-streaming-api

我尝试过Twitter文档,但没有指定其实现。我使用了包'twitter'来进行流式传输。在该软件包的文档页面上:this doc他们只提供了状态/过滤器流。我需要在我的节点js应用程序中使用直接消息流。我没有在互联网上找到任何这方面的例子。 任何人都可以提供如何使用带有代码的节点js中的Twitter API实现直接消息流的示例吗?任何帮助,将不胜感激。

1 个答案:

答案 0 :(得分:1)

在搜索并尝试了许多节点包后,我使用twit package得到了我的答案。我使用twit包创建了直接消息流,如下面的代码所示。

-(CLLocationCoordinate2D) getLocation
{
  CLLocation *location = [_locationManager location];
  coordinate = [location coordinate];
  return coordinate;
}

  CGRect frame = CGRectMake(0, 0, kSCREEN_WIDTH,kSCREEN_HEIGHT);
  GMSCameraPosition *camera = [GMSCameraPosition cameraWithLatitude:latitude longitude:longitude zoom:12];
  mapView_ = [GMSMapView mapWithFrame:frame camera:camera];
  mapView_.myLocationEnabled = YES;
  mapView_.delegate = self;

 [mapView_ setCamera:camera];

每次消息来验证用户时,此流将返回直接消息的json数据。

相关问题