title: JSON Streaming in chunks using Alamofire Swift
body: <p>How to request using Alamofire to get stream JSON. I am using the below function to get the response </p>
  
  <pre><code>self.sessionManager?.request(url, method: methodType!, parameters: params, encoding: JSONEncoding.default, headers: headers)
              .validate()
              .responseJSON { (response) in
                  if (response.result.error == nil) {
                      completion(response.result.value as AnyObject?, nil , response.response?.statusCode )
                  } else {
                      // debugPrint("HTTP Request failed: \(String(describing: response.result.error))")
                      completion(nil, response.result.error, response.response?.statusCode)
                  }
          }
  </code></pre>
  
  <p>And my API Url something like </p>
  
  <blockquote>
    <p>http://{server Url}/services/data/{number of chunks}/{items in per chunk}</p>
  </blockquote>
  
  <p>and the response I get from API if the number of chunks is 3 and items per chunk is 3 </p>
  
  <pre><code>data: [
      {
          "invalidDraft": false,
          "bulkReserve": false,
          "srNo": 0,
          "returned": false,
          "status": "ACTIVE",
          "timestamp": 1580186026419,
  
      },
      {
          "invalidDraft": false,
          "bulkReserve": false,
          "srNo": 0,
          "returned": false,
          "status": "ACTIVE",
          "timestamp": 1580186026417,
      },
      {
          "invalidDraft": false,
          "bulkReserve": false,
          "srNo": 0,
          "returned": false,
          "status": "ACTIVE",
          "timestamp": 1580186026417,
      }
  ]
  
  data: [
      {
          "invalidDraft": false,
          "bulkReserve": false,
          "srNo": 0,
          "returned": false,
          "status": "ACTIVE",
          "timestamp": 1580186026417,
      },
      {
          "invalidDraft": false,
          "bulkReserve": false,
          "srNo": 0,
          "returned": false,
          "status": "ACTIVE",
          "timestamp": 1580186026417,
      },
      {
          "invalidDraft": false,
          "bulkReserve": false,
          "srNo": 0,
          "returned": false,
          "status": "ACTIVE",
          "timestamp": 1580186026417,
      }
  ]
  
  data: [
      {
          "invalidDraft": false,
          "bulkReserve": false,
          "srNo": 0,
          "returned": false,
          "status": "ACTIVE",
          "timestamp": 1580186026417,
      },
      {
          "invalidDraft": false,
          "bulkReserve": false,
          "srNo": 0,
          "returned": false,
          "status": "ACTIVE",
          "timestamp": 1580186026417,
      },
      {
          "invalidDraft": false,
          "bulkReserve": false,
          "srNo": 0,
          "returned": false,
          "status": "ACTIVE",
          "timestamp": 1580186026417,
      }
  ]
  
  data:done
  </code></pre>
  
  <p>I did not get any response from the server but in Postman it works fine.</p>