How many connections can I open?
Up to three open connections per originating IP and three subscribed connections per account.
Track ship movements, monitor maritime accidents and discover ship's cargo from aisstream.io's websocket api in real-time and for free.
{
"MessageType": "PositionReport",
"MetaData": {
"ShipName": "EVER GIVEN",
"Latitude": 30.002,
"Longitude": 32.583
},
"Message": {
"PositionReport": { "Sog": 9.4, "Cog": 318.2 }
}
}{
"MessageType": "PositionReport",
"MetaData": {
"ShipName": "OOCL HONG KONG",
"Latitude": 1.264,
"Longitude": 103.84
},
"Message": {
"PositionReport": { "Sog": 12.1, "Cog": 57.6 }
}
}{
"MessageType": "PositionReport",
"MetaData": {
"ShipName": "CMA CGM JACQUES SAADE",
"Latitude": 43.32,
"Longitude": 5.35
},
"Message": {
"PositionReport": { "Sog": 8.7, "Cog": 274.2 }
}
}{
"MessageType": "PositionReport",
"MetaData": {
"ShipName": "MAERSK MC-KINNEY MOLLER",
"Latitude": 51.905,
"Longitude": 4.485
},
"Message": {
"PositionReport": { "Sog": 11.3, "Cog": 91.8 }
}
}{
"MessageType": "PositionReport",
"MetaData": {
"ShipName": "QUEEN MARY 2",
"Latitude": 50.8812,
"Longitude": -1.3983
},
"Message": {
"PositionReport": { "Sog": 10.8, "Cog": 132.4 }
}
}Quick start
const WebSocket = require("ws");
const socket = new WebSocket("wss://stream.aisstream.io/v0/stream");
socket.on("open", () => socket.send(JSON.stringify({
APIKey: process.env.AISSTREAM_API_KEY,
BoundingBoxes: [[[25.835, -80.208], [25.603, -79.879]]],
FilterMessageTypes: ["PositionReport"]
})));
socket.on("message", data => {
const event = JSON.parse(data.toString());
console.log(event.MessageType);
});Our global network of Automatic Identification System (AIS) stations, which power aisstream.io's tracking capabilities, allows us to stream much more than just ship positions.
create a accountTrack ships port calls, voyage destination and ship properties such as it's registered name.
Track observed dangers at sea as well as ship accidents and rescues.
Follow search and rescue aircraft movements at sea. Track their response to accidents.
See the messages ships send to each other using the ais system.
Common questions
Up to three open connections per originating IP and three subscribed connections per account.
AIS is event-driven, so filters and current vessel activity affect volume. If you do not consume messages quickly enough and sufficient buffered messages accumulate, the service drops messages.
No. Direct browser connections are not permitted. Connect from your own server and proxy only the information your clients need. This protects the API key and reduces load on the stream service.
Use focused geographic and message-type filters, and negotiate permessage-deflate compression in your WebSocket client to avoid dropped events fro slow reads.