     
     init() {
         
+        
+        super.init(serviceURL: serviceURL)
+        
         opus.createEncoder(Int32(WATSON_AUDIO_SAMPLE_RATE))
+        
+    }
+    
+    public func getToken( oncompletion: (String?, NSError) -> Void)
+    {
+        
+        NetworkUtils.requestAuthToken(tokenURL, serviceURL: serviceURLFull, apiKey: self._apiKey, completionHandler: {
+            
+            token, error in
+            
+            oncompletion(token!, error!)
+        })
         
     }
     

    The IBM® Speech to Text service provides an Application Programming Interface (API) that
    enables you to add speech transcription capabilities to your applications.
*/
public class SpeechToText {
    
    
    
    private let WATSON_AUDIO_SAMPLE_RATE = 16000
    private let WATSON_AUDIO_FRAME_SIZE = 160

        
        let newData = NSData(bytesNoCopy: ptr, length: Int(buffer.mAudioDataByteSize), freeWhenDone: false)
        
        data.watsonSocket.send(newData)
        // Log.sharedLogger.info("Added the audio to the queue")
        //let o1 = AudioUploadOperation(data: newData, socket: data.socket!)
        //data.audioUploadQueue.addOperation(o1)
        
